【问题标题】:Field Name "_LikeCount and _CommentCount" is not recognize in Graph Explorer图形资源管理器中无法识别字段名称“_LikeCount 和 _CommentCount”
【发布时间】:2021-11-21 04:55:23
【问题描述】:

您好,我正在尝试在 SharePoint SitePages 中查询最喜欢和评论最多的新闻,但是当尝试使用 _LikeCount 和 _CommentCount 进行降序排序时,我收到了这个错误:

提供的字段名称无法识别

。除了这两个之外,我对其他字段没有任何问题。

 https://graph.microsoft.com/v1.0/sites/{ID}/lists/Site Pages/items?$filter=fields/PromotedState eq 2&expand=fields($select=createdDateTime,BannerImageUrl,PromotedState,FileLeafRef,AuthorLookupId,Modified,_CommentCount,_LikeCount,Title,Description,LinkTitle)&$top=5&$orderby=fields/_LikeCount desc

感谢任何帮助。谢谢!

【问题讨论】:

    标签: sharepoint microsoft-graph-api spfx


    【解决方案1】:

    在我看来,PromotedState 字段名称未被识别为有效字段名称,而且 $orderby 子句不支持按字段 _LikeCount 排序。

    尝试在没有$filter$orderby 的情况下运行查询以检查返回的字段

    https://graph.microsoft.com/v1.0/sites/{ID}/lists/Site Pages/items?$expand=fields($select=createdDateTime,BannerImageUrl,PromotedState,FileLeafRef,AuthorLookupId,Modified,_CommentCount,_LikeCount,Title,Description,LinkTitle)&$top=5
    

    使用$orderby 运行查询

    https://graph.microsoft.com/v1.0/sites/{ID}/lists/Site Pages/items?$expand=fields($select=createdDateTime,BannerImageUrl,PromotedState,FileLeafRef,AuthorLookupId,Modified,_CommentCount,_LikeCount,Title,Description,LinkTitle)&$top=5&$orderby=fields/_LikeCount desc
    

    它将返回invalidRequest 错误。

    使用$filter 运行查询

    https://graph.microsoft.com/v1.0/sites/{ID}/lists/Site Pages/items?$expand=fields($select=createdDateTime,BannerImageUrl,PromotedState,FileLeafRef,AuthorLookupId,Modified,_CommentCount,_LikeCount,Title,Description,LinkTitle)&$filter=fields/PromotedState eq 2&$top=5
    

    它将返回invalidRequest 错误。

    【讨论】:

    • PromotedState 与 $orderby 和 $filter 一起使用。但是 _LikeCount 和 _CommentCount 并没有返回“ror”:{“code”:“invalidRequest”,“message”:“无法识别提供的字段名称”,知道如何使它工作吗?谢谢!
    • @BizApps 是否可以在客户端订购结果?
    • 我们在客户端打点的问题是网站页面的来源可能包含数千个页面,所以如果我们在客户端这样做会很慢。
    猜你喜欢
    • 1970-01-01
    • 2019-05-12
    • 2021-02-10
    • 2019-09-01
    • 2020-10-07
    • 2016-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多