[英]SharePoint 2013 REST API - Post SocialRestPostCreationData
I'm currently working on a small application to push Post to a SharePoint 2013 SiteFeed using the Social.Feed API. 我目前正在开发一个小型应用程序,以使用Social.Feed API将Post推送到SharePoint 2013 SiteFeed。
Basic Posts using the following JSON Object structure are working fine but I'm struggling using a Social-Attachment. 使用以下JSON对象结构的基本帖子工作正常,但我在使用社交附件时遇到了麻烦。
As long I'm referencing to the files located somewhere in the internet everything works. 只要我指的是Internet上某处的文件,一切正常。 Posts will create listitems in micro-feed list with HTTP-Reference to the Files. 帖子将在HTTP引用文件的微型提要列表中创建列表项。 The Object I'm using is set up like this 我正在使用的对象是这样设置的
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,
}
}
};
Is there a possibility to use a local file instead? 是否可以使用本地文件? - Removing the google paths and using a local path in ContentUri will end up in a BAD-Request error. -在ContentUri中删除Google路径并使用本地路径将导致BAD-Request错误。
I guess that the files has to be uploaded somehow before. 我想文件必须以某种方式上传。
Thanks for you help. 感谢您的帮助。
Iki 壹岐
After some trying we now ended up with the following solution. 经过一番尝试,我们现在得出以下解决方案。
Before we create the SocialPost, we upload the picture into an image gallery where all Feed users have access to. 在创建SocialPost之前,我们将图片上传到所有Feed用户都可以访问的图片库中。
Then we create the post containing a link to the image 然后我们创建包含图像链接的帖子
-> This will do the trick. ->这样就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.