使用Power Automate为SharePoint列表项添加注释失败的问题排查
问题解答
1. 操作错误点
- Uri拼写错误:报错提示找不到
Commnets资源,说明你在Uri里把正确的Comments拼写成了Commnets(多了一个n,少了一个e),这是直接触发错误的原因。 - 端点路径错误:即便修正拼写,直接调用
/items(<Item ID>)/Comments发起POST请求也不符合SharePoint Online现代列表评论的API规范,该路径并非用于新增评论的正确端点。
2. 可用的API端点
以下两种API端点可用于添加列表项评论:
方法一:使用SP.Comments.CommentsUtility.AddComment
配置参数如下:
- Method: POST
- Uri:
_api/SP.Comments.CommentsUtility.AddComment - Headers:
Content-Type: application/json;odata=verboseAccept: application/json;odata=verbose
- Body:
{ "comment": "This is a comment.", "itemId": "<Item ID>", "listId": "<List GUID>", "serverRelativeUrl": "<Site Server Relative URL>" }
说明:列表GUID可通过调用_api/web/lists/getbytitle('Project Tracker')获取返回结果中的Id字段;站点相对URL格式类似/sites/YourSiteName。
方法二:使用Social Feed API
配置参数如下:
- Method: POST
- Uri:
_api/social.feed/my/feed/posts - Headers:
Content-Type: application/json;odata=verbose
- Body:
{ "restCreationData": { "__metadata": { "type": "SP.Social.SocialRestCreationData" }, "contentText": "This is a comment.", "target": { "__metadata": { "type": "SP.Social.SocialLink" }, "Uri": "<Full URL of the List Item>" } } }
说明:列表项完整URL格式类似https://yourtenant.sharepoint.com/sites/YourSite/Lists/Project Tracker/DispForm.aspx?ID=<Item ID>。
3. 权限要求
你拥有列表的完全控制权限,已满足添加评论的核心权限要求。需额外确认两点:
- Power Automate中使用的SharePoint连接账户,必须具备该列表的编辑或完全控制权限(若使用服务账户需单独验证权限)。
- 列表的评论功能已开启:进入列表设置的「高级设置」,确认「允许评论」选项设置为「是」。
内容的提问来源于stack exchange,提问作者Asit Das
相关产品推荐
相关产品推荐

