4

I'm getting the following error when trying to update a taxonomy field value via REST api:

{
  "error": {
    "code": "-1, Microsoft.SharePoint.Client.ClientServiceException",
    "message": {
      "lang": "en-US",
      "value": "Cannot deserialize data for type Microsoft.SharePoint.Taxonomy.TaxonomyFieldValueCollection."
    }
  }
}

The request:

https://server/_api/web/GetFileByServerRelativeUrl('/Shared Documents/file.txt')/ListItemAllFields

{
  "__metadata": {
    "type": "SP.Data.Shared_x0020_DocumentsItem"
  },
  "Title": "some title",
  "Project": {
    "results": [
      {
        "Label": "Term1",
        "TermGuid": "897bdf7f-08d6-44b9-a71a-ddc4cf131664",
        "WssId": 5
      }
    ]
  }
}
3

The REST API does not currently support working with Managed Metadata or Taxonomy fields. The JavaScript Client Object Model does, if you're looking for an alternative.

  • 1
    Rob: Is it possible to filter by a taxonomy column? Something like &$select=Score/WssId &$expand=Score/WssId &$filter=Score/TermGuid eq 7f4bd49f-8dbc-4e6f-a165-cbdf4b0ba7d1. I'm trying to do this following AC's post here: andrewconnell.com/blog/… – Marc D Anderson Sep 15 '13 at 19:13
  • Don't suppose that this is coming soon? – jasonscript May 7 '15 at 3:49
  • 3
    Are you sure it's not just multi-fields which are not supported? It works fine with TaxonomyFieldType, just not with multi. If the field was a single field it would look something like: Project: { __metadata: { type: "SP.Taxonomy.TaxonomyFieldValue" }, TermGuid: "897bdf7f-08d6-44b9-a71a-ddc4cf131664", WssId: -1 } . I am not able to make it work for TaxonomyFieldTypeMulti. – eirikb Jun 7 '15 at 16:49
  • While you may be able to get certain things to work, it is not something that is documented or officially supported. If you look at the REST API reference you'll find no mention of SP.Taxonomy or anything under SP.Taxonomy msdn.microsoft.com/en-us/library/office/jj860569.aspx – Rob Windsor Jun 7 '15 at 17:16
  • Just noticed Marc's comment (even though it's from 2013). The answer is yes, you can filter on a managed metadata column if you use a CAML Query. cleverworkarounds.com/2013/09/23/… – Rob Windsor Jun 7 '15 at 17:19

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.