SharePoint 2013 REST API - 发布SocialRestPostCreationData

问题描述:

我目前正在使用Social.Feed API将一个小应用程序推送到SharePoint 2013 SiteFeed。SharePoint 2013 REST API - 发布SocialRestPostCreationData

使用以下JSON对象结构的基本职位工作正常,但我正在努力使用社会附件。

只要我参考位于互联网某处的文件,一切正常。帖子将使用对文件的HTTP引用在微型订阅源列表中创建列表项。我正在使用的对象是这样设置的

var creationInfo = new 
    { 
     restCreationData = new 
     { 
      __metadata = new { type = "SP.Social.SocialRestPostCreationData" }, 
      ID = array, 
      creationData = new 
      { 
       __metadata = new { type = "SP.Social.SocialPostCreationData" }, 

       Attachment = new 
       { 
        __metadata = new { type = "SP.Social.SocialAttachment" }, 
        AttachmentKind = 0, 
        ContentUri = "https://www.google.com/images/icons/hpcg/ribbon-black_68.png", 
        Description = "Look at this", 
        Name = "Test", 
        Uri = "https://www.google.com/images/icons/hpcg/ribbon-black_68.png" 
       }, 
       ContentText = text, 
       UpdateStatusText = false, 
      } 
     } 
    }; 

是否有使用本地文件的可能性? - 删除google路径并在ContentUri中使用本地路径将以BAD-Request错误结束。

我想这些文件必须以某种方式上传之前。

感谢您的帮助。

壹岐

经过一番努力,我们现在结束了以下解决方案。

  • 在我们创建SocialPost之前,我们将图片上传到所有Feed用户有权访问的图库中。

  • 然后我们创建一个包含一个链接后的图像

- >这将这样的伎俩。