The below mentioned code works sometimes and doesn't most of the time. What is the real best way to update multi select managed metadata fields?
Microsoft.SharePoint.Client.File file = site.GetFileByServerRelativeUrl("/sites/myspsite/Documents/Presentation2.pptx");
clientContext.Load(file);
clientContext.ExecuteQuery();
ListItem currentItem = file.ListItemAllFields;
clientContext.Load(currentItem);
clientContext.ExecuteQuery();
currentItem["Country"] = "-1;#India|1d13cfe9-d6f4-4bd3-a6c7-4b46a81f2a96;#-1;#China|9c1dff73-82db-44b1-8d70-f4258dd24e47;#-1;#USA|b9295c0b-67d4-4dc5-99d4-e88af888de48";
currentItem["Title"] = "Demo Doc";
currentItem.Update();
clientContext.ExecuteQuery();
file.CheckIn("test check-in", CheckinType.MajorCheckIn);
clientContext.ExecuteQuery();
Anuradha!!
No comments:
Post a Comment