Sharepoint 2013 如何使用 soap API 更新托管元数据字段 (TaxonomyFieldTypeMulti)

sharepoint 2013 how to update managed metadata field (TaxonomyFieldTypeMulti) using soap API

我正在尝试使用 SOAP API 更新托管元数据字段 (TaxonomyFieldType) 以下是我的 SOAP XML.

<Batch OnError = "Continue">
    <Method ID = "1" Cmd = "Update">
        <Field
            Name = "ID"
            xsi:type = "xsd:string"
            xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd = "http://www.w3.org/2001/XMLSchema">12</Field>
        <Field
            Name = "TaskOutcome"
            xsi:type = "xsd:string"
            xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd = "http://www.w3.org/2001/XMLSchema">Approved</Field>
        <Field
            Name = "Title"
            xsi:type = "xsd:string"
            xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd = "http://www.w3.org/2001/XMLSchema">sample</Field>
        <Field
            Name = "FileRef"
            xsi:type = "xsd:string"
            xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd = "http://www.w3.org/2001/XMLSchema">sample.txt</Field>
        <Field
            Name = "MM"
            DisplayName = "MM_0"
            Type = "TaxonomyFieldTypeMulti"
            xsi:type = "xsd:string"
            xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd = "http://www.w3.org/2001/XMLSchema">-1;#test2|168baffc-6f72-46cd-8750-98d53ed1acca</Field>
    </Method>
</Batch>

服务器没有错误,托管元数据文件未更新。

你能帮我看看我这里做错了什么吗?

当您使用 Note fieldType 在 SharePoint 中添加托管元数据字段时,它将添加字段类型为 Note 的隐藏字段和字段类型为 TaxonomyFieldTypeMulti 或 TaxonomyFieldType 的非隐藏字段

<Field
   Name = "MM"
    DisplayName = "MM_0"
    Type = "TaxonomyFieldTypeMulti"
    xsi:type = "xsd:string"
    xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd = "http://www.w3.org/2001/XMLSchema">-1;#test2|168baffc-6f72-46cd-8750-98d53ed1acca</Field>

无需更新上述字段,您需要使用 DisplayName = "MM_0" 和 Name = "Some Id"

更新其隐藏的 Note 字段类型
<Field
    Name = "of525fec62a44747aa623e3c49dac9e8"
    DisplayName = "MM_0"
    Type = "Note"
    xsi:type = "xsd:string"
    xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd = "http://www.w3.org/2001/XMLSchema">test2|168baffc-6f72-46cd-8750-98d53ed1acca</Field>

在 SOAP 中,您的请求应该如下所示

<Method Cmd="Update" ID="1">
<Field Name="ID">12</Field>
 <Field Name="Title">Sample</Field>
 <Field Name="of525fec62a44747aa623e3c49dac9e8">test2|168baffc-6f72-46cd-8750- 
 98d53ed1acca</Field>
  </Method>

如果您使用模式生成带有隐藏字段类型的模式,请注意您将获得带有 "Name="of525fec62a44747aa623e3c49dac9e8" 的模式,您可以轻松更新该值。

Sharpoint return as Note fieldType as

<Field Type="Note" DisplayName="MM_0" StaticName="of525fec62a44747aa623e3c49dac9e8" 
 Name="of525fec62a44747aa623e3c49dac9e8" 
  ID="{6DDB9ADF-BC5E-4D07-BE70-F450A24C7520}" ShowInViewForms="FALSE" Required="FALSE" 
  CanToggleHidden="TRUE"  Hidden="TRUE"/>

希望以上解释能解决您的问题!!!