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
