3

I have two managed metadata fields in my list, they both can have multiple values, the first one is 'mm' and the second one has a danish symbol Ø - 'mm_Ø'. I fetch the fields information using SharePoint REST API endpoint:

GET https://{tenant}.sharepoint.com/{site-path}/_api/Web/Lists(guid'{list-id}')/fields

In the response I see my fields definitions: The 'mm' field is:

 {
        "odata.type": "SP.Taxonomy.TaxonomyField",
        ***
        "CanBeDeleted": true,
        "ClientSideComponentId": "00000000-0000-0000-0000-000000000000",
        "ClientSideComponentProperties": null,
        "ClientValidationFormula": null,
        "ClientValidationMessage": null,
        "CustomFormatter": null,
        "DefaultFormula": null,
        "DefaultValue": "",
        "Description": "",
        "Direction": "none",
        "EnforceUniqueValues": false,
        "EntityPropertyName": "mm",
        "Filterable": true,
        "FromBaseType": false,
        "Group": "Custom Columns",
        "Hidden": false,
        "Id": "f863fab3-5611-4d81-82f9-299c42e6258c",
        "Indexed": false,
        "IndexStatus": 0,
        "InternalName": "mm",
        "JSLink": "SP.UI.Taxonomy.js|SP.UI.Rte.js(d)|SP.Taxonomy.js(d)|ScriptForWebTaggingUI.js(d)",
        "PinnedToFiltersPane": false,
        "ReadOnlyField": false,
        "Required": false,
        "SchemaXml": "***",
        "Scope": ***,
        "Sealed": false,
        "ShowInFiltersPane": 0,
        "Sortable": false,
        "StaticName": "mm",
        "Title": "mm",
        "FieldTypeKind": 0,
        "TypeAsString": "TaxonomyFieldTypeMulti",
        "TypeDisplayName": "Managed Metadata",
        "TypeShortDescription": "Managed Metadata",
        "ValidationFormula": null,
        "ValidationMessage": null,
        "AllowMultipleValues": true,
        "DependentLookupInternalNames": [],
        "IsDependentLookup": false,
        "IsRelationship": true,
        "LookupField": "Term$Resources:core,Language;",
        "LookupList": "{6eaf0d27-f293-4017-bac5-b3ef9b3fe079}",
        "LookupWebId": "e0087d65-0dcb-41a5-bb7c-c4b2f94fed59",
        "PrimaryFieldId": null,
        "RelationshipDeleteBehavior": 0,
        "UnlimitedLengthInDocumentLibrary": false,
        "AnchorId": "00000000-0000-0000-0000-000000000000",
        "CreateValuesInEditForm": false,
        "IsAnchorValid": true,
        "IsKeyword": false,
        "IsPathRendered": false,
        "IsTermSetValid": true,
        "Open": true,
        "SspId": "a1796552-9a87-4f1d-95d5-b4a3fc8f143d",
        "TargetTemplate": null,
        "TermSetId": "8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f",
        "TextField": "93148f4a-853f-4851-a600-3f76b38d030a",
        "UserCreated": false
    }

And the 'mm_Ø' field:

{
            "odata.type": "SP.Taxonomy.TaxonomyField",
            ***
            "AutoIndexed": false,
            "CanBeDeleted": true,
            "ClientSideComponentId": "00000000-0000-0000-0000-000000000000",
            "ClientSideComponentProperties": null,
            "ClientValidationFormula": null,
            "ClientValidationMessage": null,
            "CustomFormatter": null,
            "DefaultFormula": null,
            "DefaultValue": "",
            "Description": "",
            "Direction": "none",
            "EnforceUniqueValues": false,
            "EntityPropertyName": "mm__x00d8_",
            "Filterable": true,
            "FromBaseType": false,
            "Group": "Custom Columns",
            "Hidden": false,
            "Id": "8b6cb6c7-5bdf-4e87-95e0-8ad6db1bc60e",
            "Indexed": false,
            "IndexStatus": 0,
            "InternalName": "mm__x00d8_",
            "JSLink": "SP.UI.Taxonomy.js|SP.UI.Rte.js(d)|SP.Taxonomy.js(d)|ScriptForWebTaggingUI.js(d)",
            "PinnedToFiltersPane": false,
            "ReadOnlyField": false,
            "Required": false,
            "SchemaXml": "***",
            "Scope": ***,
            "Sealed": false,
            "ShowInFiltersPane": 0,
            "Sortable": false,
            "StaticName": "mm__x00d8_",
            "Title": "mm_Ø",
            "FieldTypeKind": 0,
            "TypeAsString": "TaxonomyFieldTypeMulti",
            "TypeDisplayName": "Managed Metadata",
            "TypeShortDescription": "Managed Metadata",
            "ValidationFormula": null,
            "ValidationMessage": null,
            "AllowMultipleValues": true,
            "DependentLookupInternalNames": [],
            "IsDependentLookup": false,
            "IsRelationship": true,
            "LookupField": "Term$Resources:core,Language;",
            "LookupList": "{6eaf0d27-f293-4017-bac5-b3ef9b3fe079}",
            "LookupWebId": "e0087d65-0dcb-41a5-bb7c-c4b2f94fed59",
            "PrimaryFieldId": null,
            "RelationshipDeleteBehavior": 0,
            "UnlimitedLengthInDocumentLibrary": false,
            "AnchorId": "00000000-0000-0000-0000-000000000000",
            "CreateValuesInEditForm": false,
            "IsAnchorValid": true,
            "IsKeyword": false,
            "IsPathRendered": false,
            "IsTermSetValid": true,
            "Open": true,
            "SspId": "a1796552-9a87-4f1d-95d5-b4a3fc8f143d",
            "TargetTemplate": null,
            "TermSetId": "8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f",
            "TextField": "b658e553-725e-4e24-9a6a-c911b50d68a4",
            "UserCreated": false
        }

Now, I want to create an item in that list using REST endpoint:

POST https://{tenant}.sharepoint.com/{site-path}/_api/Web/Lists(guid'{list-id}')/items

First I try to create an item only filling the mm field Body:

{
  "Title": "Item1",
  "f863fab356114d8182f9299c42e6258c": "taxonomy|24a5a5fa-7a1d-48d6-8a2d-7937429dfd71;taxonomy2|23901385-e142-458c-85f2-4b5ca5dbd812"
}

And it works. Now I want to do the same but filling the 'mm_Ø' field. Body:

{
  "Title": "ee",
  "l910ce92c882443cb3134a7aeed731f7": "taxonomy|24a5a5fa-7a1d-48d6-8a2d-7937429dfd71;taxonomy2|23901385-e142-458c-85f2-4b5ca5dbd812"
 }

The response I get:

{
    "odata.error": {
        "code": "-2130575340, Microsoft.SharePoint.SPException",
        "message": {
            "lang": "en-US",
            "value": "One or more field types are not installed properly. Go to the list settings page to delete these fields."
        }
    }
}

Does it mean that having symbols other than English in the Managed Metadata causes SharePoint REST API to fail?

1 Answers1

1

From what I can tell, if the meta data field title is too long (each non-standard English letter is 8 letters) then we are getting this error.

Couldn't find a solution except renaming to something shorter/no special characters.

Another solution is to use this new API:

https://[tenant].sharepoint.com/sites/test/_api/web/GetList(@a1)/AddValidateUpdateItemUsingPath()?@a1=%27%2Fsites%2Ftest%2FLists%2FMyList%27

=== update === Found a solution, might help you. In our case, the hidden note field's title was created with wrong value. it suppose to be "[meta data title]_0" but the special characters were cut off.

If I manually updated the hidden note field's title to "[meta data title]_0" the update works as expected.

It leads me to believe the API in the back end is relying on the field title instead of internal name/TextField property to map the value from the note field back to the meta data field.

Shai Petel
  • 188
  • 11
  • lifesaver... the "special characters" that were messing it up were spaces in the column name in my case. Recreating the column with no spaces in the name worked. – Rots May 08 '23 at 09:39