你好,我试图查询最喜欢和评论的新闻在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
任何帮助都是感激的。谢谢!
在我看来,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
错误。