1

I have a very peculiar problem. I am updating a list with a multi-value taxonomy field via REST on a SharePoint hosted app. Other list fields are being updated apart from this one multi-value taxonomy field. No error is being thrown. Here is my code

var body = {
  "Title": "Title of list item",
  "i2eb836f74154a63a65bdddfefd7e5e5": "-1;#Biosciences|f33e6f09-29ed-4d2f-a232-3c1da3c84710;#-1;#Clinical|589af719-fd79-4b44-ab4c-03cf9247f2c5;#",
  "__metadata": {
     "type": "SP.Data.ListTitleListItem"
  }
};

$http({
        url: appUrl + '/_api/SP.AppContextSite(@target)/web/Lists/getByTitle('ListTitle')/Items?@target='hostUrl',
        method: "POST",
        headers: {
            "Accept": "application/json;odata=verbose",
            "Content-Type": "application/json;odata=verbose",
            "Content-Length": body.length,
            "X-RequestDigest": formDigestValue
        },
        data: JSON.stringify(body)
   })

Where

'i2eb836f74154a63a65bdddfefd7e5e5'

is the internal name for the hidden note field corresponding to the multi-value taxonomy field and the string below

"-1;#Biosciences|f33e6f09-29ed-4d2f-a232-3c1da3c84710;#-1;#Clinical|589af719-fd79-4b44-ab4c-03cf9247f2c5;#"

represents the values that I'm trying to insert into this field. I created this field via visual studio and I am able to insert values into it if I update the list item from the SharePoint UI. What perturbs me is that the above code works perfectly for a multi-value taxonomy field I created directly from the SharePoint UI. Has anyone experienced this before, and if so, how did you resolve it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.