共享点错误:此项不支持顶

时间:2019-08-21 12:32:59

标签: api sharepoint

我正在尝试创建一个Sharepoint iOS应用,并使用其余的api,我收到错误消息“该项目不支持喜欢”。对https://tenant.sharepoint.com/News/_api/web/lists/getbytitle('pages')/ items('1234')/ like进行POST之后。

有人知道这种错误吗?

似乎在Sharepoint服务器上正确设置了“评分”设置,因为like选项在网站上正常运行,并且在应用程序中,我可以在Rest API调用https://tenant.sharepoint.com/News/_api/web/lists/getbytitle的响应中看到likesCount属性。 (“页面”)/项目(“ 1234”)。

我认为客户端应用的实现没有问题,但这与Sharepoint配置有关,尽管我还没有看到有关评级设置的更多设置,包括移动设备的Sharepoint访问权限应用程序。

Web似乎可以使用Microsoft.Office.Server.ReputationModel.Reputation.setLike函数来处理此问题,该函数可以再次在Web部件上正常工作,但我找不到从移动应用程序执行此操作的方法。

1 个答案:

答案 0 :(得分:0)

要为列表项设置“顶”,我们需要在POST请求中使用以下API。

https://tenant.sharepoint.com/News/_api/web/lists/getbytitle('pages')/items('1234')

并按如下所示传递POST请求的数据。

var item = {
    "__metadata": { "type": "SP.Data.PagesItem"},
    "LikedByStringId":  {"results": ["11"]},
    "LikesCount": 2
};

在为项目设置“喜欢”之前,我们需要使用下面带有GET请求的API来获取列表项目的“ LikedByStringId”和“ LikesCount”值,然后设置一个新值。

https://tenant.sharepoint.com/News/_api/web/lists/getbytitle('pages')/items('1234')

在此处查看文章:Demonstrates how to like/unlike resource via SharePoint REST API