【问题标题】:Unable to update Hyperlink or Picture in SharePoint via Microsoft Graph无法通过 Microsoft Graph 更新 SharePoint 中的超链接或图片
【发布时间】:2019-10-13 21:10:34
【问题描述】:

我正在尝试更新列表项的值(类型为超链接或图片)。执行 GET 请求时,数据返回正常,但是当我尝试创建项目或使用值更新它时,我最终得到以下结果:

{
    "error": {
        "code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
        "message": "A value without a type name was found and no expected type is available. When the model is specified, each value in the payload must have a type which can be either specified in the payload, explicitly by the caller or implicitly inferred from the parent value.",
        "innerError": {
            "request-id": "d12dfb12-a068-4621-9f27-d284e4635060",
            "date": "2019-05-28T08:52:51"
        }
    }
}

POST/PATCH 请求转到:

https://graph.microsoft.com/v1.0/sites/<siteid>/lists/<listid>/items/

并包含一个简单的 JSON(在 PATCH 的情况下):

{
  "WebPage":
  {
    "Description": "Microsoft Graph",
    "Url": "http://graph.microsoft.com"
  }
}

知道我做错了什么吗?我尝试使用 .NET SDK 和 Graph Explorer 并以同样的错误结束...

【问题讨论】:

    标签: microsoft-graph-api microsoft-graph-sdks


    【解决方案1】:

    要更新列表中的项目,您需要提供 ID 作为 URI 的一部分,它应该如下所示:

    PATCH https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}
    

    您遇到的错误是尝试使用 Graph 无法与该集合协调的对象更新集合时返回的错误。

    【讨论】:

      猜你喜欢
      • 2022-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多