Unable to update a Summary field of type DATE using the C# SDK

Hi Smartsheet Community!
This is my first post and I hope not to scare you away.
I've been finding the community amazingly helpful in everything I've been doing so far. Now I'm blocked and I hope someone can give me a hand .
I'm trying to set a Summary field "Project Due Date" across multiple sheets.This Summary field is of type DATE.
It works fine when I try it via the REST API in Postman.
This is the request:
PUT https://api.smartsheet.com/2.0/sheets/{sheetId}/summary/fields
This is the request body, where the ID belongs to a summary field of type DATE:
[
{
"id": {summaryFieldId},
"objectValue": {
"objectType": "DATE",
"value": "2019-11-20"
}
}
]
This works perfectly fine: the summary field gets updated to the value "11/20/19" in my UI (see attached image).
Now, when I try to do this through the API using the C# SDK, the program runs smoothly but the summary field remains empty.
Below is the code. I cannot figure out what I'm doing wrong. Your help is much appreciated!
SummaryField fieldToUpdate = new SummaryField();
fieldToUpdate.Id = {summaryFieldId};
fieldToUpdate.ObjectValue = new DateObjectValue(ObjectValueType.DATE, "2019-11-20");
List<SummaryField> updateSummaryFields = new List<SummaryField>();
updateSummaryFields.Add(fieldToUpdate);
IList<BulkItemFailure> failedResults = new List<BulkItemFailure>();
failedResults = smartsheet.SheetResources.SummaryResources.UpdateSheetSummaryFieldsAllowPartialSuccess({sheetId}, updateSummaryFields, false).FailedItems;
Note:
It works fine with summary fields of type TEXT_NUMBER, where I'm using the following code:
fieldToUpdate.ObjectValue = new StringObjectValue("a string");
Regards
Helena
Comments
-
Hi Helena,
I am able to get pretty similar code to perform as expected. Is it possible you do not have unique title names for the summary fields in your sheet? Can you post the error message you are receiving?
Thanks,
Tim
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 66.1K Get Help
- 430 Global Discussions
- 149 Industry Talk
- 490 Announcements
- 5.2K Ideas & Feature Requests
- 85 Brandfolder
- 154 Just for fun
- 74 Community Job Board
- 499 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 305 Events
- 36 Webinars
- 7.3K Forum Archives