cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

SharePoint REST query on flow not work

Hi
How can I let the Item() can get the record base on RefID but it show the error: The parameter name RefID is not valid.

 

The Comments SP list's item ID is not same as the variable "ItemID" but same as RefID. the syntax of Uri and the flow as below.

Ed_C_1-1610704445878.png

 

 

Ed_C_0-1610704380760.png

Anyone know how to do?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Hi @Ed_C,

 

Yes that should be possible via a REST API call, this time a POST request. Beau Cameron has written a nice blog about this: https://beaucameron.net/2021/01/18/add-comments-to-sharepoint-list-items-using-the-rest-api/

 

If you want to achieve this via a HTTP action in Power Automate you can use the following setup.

 

URI

_api/web/lists/getbytitle('@{variables('ListName')}')/items(@{variables('ListItemId')})/Comments()

 

Headers

{
  "accept": "application/json; odata=verbose",
  "content-type": "application/json;charset=utf-8"
}

postlistcomment_restapi.png

View solution in original post

6 REPLIES 6
Super User II
Super User II

Hi @Ed_C,

 

Just to double check. You want to collect the comments of a specific list item via the SharePoint REST API, correct?

 

If so, you could use the following Uri in your Send an HTTP request action:

_api/web/lists/getbytitle('@{variables('ListName')}')/items(@{variables('ListItemId')})/Comments

getcommentssharepoint.png

Yes, but I turn on the versioning,
There has 2 issue I don't know why it happen
1)when I add the attachment with comment it will create 2 version, which make there is an empty string
2)when I remove the attachment with comment it will create 2 version, which make there show 2 same strings

How to fix it in Flow? 

_api/web/lists/GetByTitle('Comments')/items(@{variables('CommentListIDByRefID')})/Versions

Ed_C_0-1610958483962.png

 

Super User II
Super User II

Hi @Ed_C,

 

Just to double check. Is your SharePoint List Name Comments or are you talking about the Comments feature? Can you also share a screenshot of the SharePoint list you are trying to interact with?

 

As far as I am aware Comments don't update the version number of an item in a list. Every time you add a comment nothing will happen to the version number. 

 

See an example below of that. I have enabled versioning on my ListComments list. Added 3 separate comments in a timespan of a couple of seconds and the version of the item number 1 remains at version 1.0.

 

versioning_comments.png

 

 

 

Oh sorry my description is too unclear let me show you my list.

Ed_C_0-1611019094712.png

My list call 'Comments' and the field 'ticketComment'  is collecting user comments by versioning control not the list default comment function on SharePoint list

 

Regular Visitor

But it may a solution using comment function instead of using versioning. Now, I know how to get the comment  right? Is there possible to write the comment through power app?

 

_api/web/lists/GetByTitle('Comments')/items(@{variables('ListID')})/Comments

 

 

Super User II
Super User II

Hi @Ed_C,

 

Yes that should be possible via a REST API call, this time a POST request. Beau Cameron has written a nice blog about this: https://beaucameron.net/2021/01/18/add-comments-to-sharepoint-list-items-using-the-rest-api/

 

If you want to achieve this via a HTTP action in Power Automate you can use the following setup.

 

URI

_api/web/lists/getbytitle('@{variables('ListName')}')/items(@{variables('ListItemId')})/Comments()

 

Headers

{
  "accept": "application/json; odata=verbose",
  "content-type": "application/json;charset=utf-8"
}

postlistcomment_restapi.png

View solution in original post

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (10,603)