SharePoint 2013-使用REST API将网站列与内容类型关联

SharePoint 2013-使用REST API将网站列与内容类型关联,rest,sharepoint,sharepoint-2013,Rest,Sharepoint,Sharepoint 2013,我正在尝试使用RESTAPI以编程方式创建站点列和内容类型。在我尝试将网站列与内容类型关联之前,一切都正常 到目前为止,在我的代码中,站点列和内容类型已经存在 我正在向以下URL发送帖子 http://mydevmachine/sites/claimsreports/_api/web/ContentTypes('0x01003E9D5AD94A5DCD46876B7BFFCEA9B60C')/FieldLinks 这是我在请求正文中发送的信息 { "__metadata": { "

我正在尝试使用RESTAPI以编程方式创建站点列和内容类型。在我尝试将网站列与内容类型关联之前,一切都正常

到目前为止,在我的代码中,站点列和内容类型已经存在

我正在向以下URL发送帖子

http://mydevmachine/sites/claimsreports/_api/web/ContentTypes('0x01003E9D5AD94A5DCD46876B7BFFCEA9B60C')/FieldLinks
这是我在请求正文中发送的信息

{
  "__metadata": {
    "type": "SP.FieldLink"
  },
  "Id": "9400d057-ba2c-4ab4-9ce0-671b858fd849",
  "Name": "BusinessCategory",
  "Hidden": false,
  "Required": false
}
这是我回复的错误

{"error":{"code":"-2147467261, System.ArgumentNullException","message":{"lang":"en-US","value":"Value cannot be null.\r\nParameter name: parameters"}}}
我尝试了其他几种选择,但没有成功。例如,我曾尝试使用u元数据:{type:SP.FieldLinkCreationInformation},但我尝试使用此u元数据类型的所有操作都会导致此错误

{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"A type named 'SP.FieldLinkCreationInformation' could not be resolved by the model. When a model is available, each type name must resolve to a valid type."}}}
听起来好像SharePoint告诉我此类型无效。SharePoint 2013似乎可以做到这一点,因为文档似乎暗示它可能


如果有人有任何想法,我将非常感谢你的建议。谢谢

根据文档,我会尝试:

端点注释/在末尾添加:

http://mydevmachine/sites/claimsreports/_api/web/ContentTypes('0x01003E9D5AD94A5DCD46876B7BFFCEA9B60C')/FieldLinks/add
正文将属性包装到参数属性中:

{"parameters":
{
"__metadata": {"type": "SP.FieldLink"},
"Id": "9400d057-ba2c-4ab4-9ce0-671b858fd849",
"Name": "BusinessCategory",
"Hidden": false,
"Required": false
}
}