C# 使用Microsoft Graph将图像发布到sharepoint列表中

C# 使用Microsoft Graph将图像发布到sharepoint列表中,c#,sharepoint,microsoft-graph-api,.net-core-2.1,C#,Sharepoint,Microsoft Graph Api,.net Core 2.1,我正在使用Microsoft Graph API处理MS Sharepoint。我使用.Net Core v2.1调用MS Graph API 我想在Sharepoint列表中做一个POST请求,其中一列是图像列,但我找不到关于如何做的文档。。。请问有人知道更多关于如何做吗 更新: 我看到了这一点,并更改了我的json: { "fields": { "Title": "Test", "Photo": { "Url": "https://myurl/picture.

我正在使用Microsoft Graph API处理MS Sharepoint。我使用.Net Core v2.1调用MS Graph API

我想在Sharepoint列表中做一个POST请求,其中一列是图像列,但我找不到关于如何做的文档。。。请问有人知道更多关于如何做吗

更新:

我看到了这一点,并更改了我的json:

{
  "fields": {
    "Title": "Test",
    "Photo": {
      "Url": "https://myurl/picture.jpg",
      "Description":"This is my picture"
    }
  }
}
但我有一条错误信息:

{
    "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": "34773f4f-131f-4249-8a03-b8a820ba4a6b",
            "date": "2019-05-16T13:26:17"
        }
    }
}

它似乎希望照片的值是一个基本值而不是一个对象…

这可能会对您有所帮助

职位 {site id}/lists/{list id}/items

假设所有图像都已上载到站点资源文件夹中。为具有站点资产图像URL id的图像列添加了以下JSON

POST https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items
Content-Type: application/json

{
  "fields": {
    "Title": "Widget",
    "Color": "Purple",
    "Weight": 32,
    "image": "/assets/image5.png" 
  }
}
参考:


希望它能帮助你

也许这会对你有所帮助

职位 {site id}/lists/{list id}/items

假设所有图像都已上载到站点资源文件夹中。为具有站点资产图像URL id的图像列添加了以下JSON

POST https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items
Content-Type: application/json

{
  "fields": {
    "Title": "Widget",
    "Color": "Purple",
    "Weight": 32,
    "image": "/assets/image5.png" 
  }
}
参考:

希望能有帮助