【问题标题】:Sharepoint error: Likes are not supported in this itemSharepoint 错误:此项目不支持点赞
【发布时间】:2019-08-21 12:32:59
【问题描述】:

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

有人知道更多关于这种错误的信息吗?

评分设置似乎在 Sharepoint 服务器上设置正确,因为类似选项在网站上正常工作,而且在应用程序中,我可以在 Rest API 调用https://tenant.sharepoint.com/News/_api/web/lists/getbytitle(' pages')/items('1234').

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

网络似乎使用 Microsoft.Office.Server.ReputationModel.Reputation.setLike 函数来处理此问题,该函数再次在网络部件上正常工作,但我无法从移动应用程序中找到方法。

【问题讨论】:

    标签: api sharepoint


    【解决方案1】:

    要为列表项设置 Likes,我们需要使用下面的 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
    };
    

    在为项目设置 Likes 之前,我们需要使用下面的 API 通过 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-17
      • 1970-01-01
      • 2019-01-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多