Sharepoint 2013 使用SharePoint REST API将值设置为多值托管元数据字段类型时出错

Sharepoint 2013 使用SharePoint REST API将值设置为多值托管元数据字段类型时出错,sharepoint-2013,sharepoint-online,csom,sharepoint-rest-api,Sharepoint 2013,Sharepoint Online,Csom,Sharepoint Rest Api,我的列表中有两个托管元数据字段,它们都可以有多个值,第一个是“mm”,第二个是丹麦符号“mm”。 我使用SharePoint REST API端点获取字段信息: GET https://{tenant}.sharepoint.com/{site-path}/_api/Web/Lists(guid'{list-id}')/fields 在响应中,我看到了我的字段定义: 'mm'字段是: { "odata.type": "SP.Taxonomy.TaxonomyField",

我的列表中有两个托管元数据字段,它们都可以有多个值,第一个是“mm”,第二个是丹麦符号“mm”。 我使用SharePoint REST API端点获取字段信息:

GET https://{tenant}.sharepoint.com/{site-path}/_api/Web/Lists(guid'{list-id}')/fields
在响应中,我看到了我的字段定义: 'mm'字段是:

 {
        "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
    }
以及'mmØ'字段:

{
            "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
        }
现在,我想使用REST端点在该列表中创建一个项:

POST https://{tenant}.sharepoint.com/{site-path}/_api/Web/Lists(guid'{list-id}')/items
首先,我尝试创建一个只填充mm字段的项目 正文:

它是有效的。现在我想做同样的事情,但是填充'mmØ'字段。 正文:

我得到的答复是:

{
    "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."
        }
    }
}

这是否意味着在托管元数据中使用英文以外的符号会导致SharePoint REST API失败?

据我所知,如果元数据字段标题太长(每个非标准英文字母为8个字母),则我们会遇到此错误

除了重命名为较短的字符/无特殊字符外,找不到解决方案

另一个解决方案是使用此新API:

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

==更新=== 找到了解决方案,可能会对你有所帮助。 在我们的例子中,隐藏注释字段的标题是用错误的值创建的。 它应该是“[元数据标题]\u 0”,但特殊字符被截断

如果我手动将隐藏注释字段的标题更新为“[meta data title]\u 0”,则更新将按预期工作

这让我相信后端的API依赖于字段标题而不是内部name/TextField属性来将值从note字段映射回元数据字段

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