我正在尝试创建一个Sharepoint iOS应用程序,使用rest api时,我收到错误消息"Likes not supported in this item“。在发布到https://tenant.sharepoint.com/News/_api/web/lists/getbytitle('pages')/items('1234')/like之后。
有谁知道更多关于这种错误的信息吗?
评级设置似乎在Sharepoint服务器上设置正确,因为like选项在网站上正常工作,而且在应用程序中,我可以看到Rest API调用https://tenant.sharepoint.com/News/_api/web/lists/getbytitle('pages')/items('1234')的响应上的likesCount属性。
我不认为客户端应用程序实现有什么问题,但它与Sharepoint配置有关,尽管我没有看到任何关于评级设置的更多设置,包括移动应用程序的Sharepoint访问权限。
web似乎使用Microsoft.Office.Server.ReputationModel.Reputation.setLike函数来处理这个问题,这个函数同样可以在web部件上正常工作,但我无法从移动应用程序中找到这样做的方法。
发布于 2019-08-22 01:58:02
要为列表项设置点赞,我们需要使用下面的API和POST请求。
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请求接口获取列表项的LikedByStringId和LikesCount值,然后设置新的。
https://tenant.sharepoint.com/News/_api/web/lists/getbytitle('pages')/items('1234')
请查看此处的文章:Demonstrates how to like/unlike resource via SharePoint REST API
https://stackoverflow.com/questions/57591724
复制相似问题