I’m trying to update a SharePoint managed metadata (MMD) field using Lists.UpdateListItems web service but it’s not working.
Here is my SOAP request
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>My Test List</listName>
<updates>
<Batch ListVersion="0" PreCalc="TRUE" OnError="Continue">
<Method Cmd="Update" ID="1">
<Field Name="ID">3</Field>
<Field Name="Document_x0020_Title">foo</Field>
<Field Name="Fiscal_x0020_Year1">13;#FY 2006|7e8205da-57a1-45a3-8147-469b795ad6e8</Field>
</Method>
</Batch>
</updates>
</UpdateListItems>
</S:Body></S:Envelope>
This request will succesfully update the “Document Title” (a text field) but the MMD field, “Fiscal Year”, was unchanged and there is no error returned from the web service.
Note that the value of the MMD is in the format “WssId;#TermValue|TermGuid” and the term has already been created for the site.
Please help.
Figured it out.
I must use a different field name. The label for the field is “Fiscal Year”, but the field name that worked is actually “d3c0ddc947ab4b8c90b6a0fe2d4caf09” instead of “Fiscal_x0020_Year1”. So my SOAP request would look like
To get this field name I use the Lists.GetListContentType web service method to return fields information and look for fieldtype “Note”. Here is an example of what SharePoint returned
I also find it useful to use the Lists.GetListContentTypes method to get the content type id use in Lists.GetListContentType method call.
—-Update—
I found that you don’t have to use the format of “WssId;#TermValue|TermGuid”. You can simply use “TermValue|TermGuid”. So in the example above the value would be “FY 2006|7e8205da-57a1-45a3-8147-469b795ad6e8”.
This is very useful because you can reuse the same value across different site unlike the former value, where you can only use it in one site. For multi value you only need to delimit it with a “;” instead of “;#”. For example “FY 2006|7e8205da-57a1-45a3-8147-469b795ad6e8;FY 2007|823205da-57a1-45a3-8147-469b795ade13”.