I wanted to dynamically set a column with hyperlink text in Power Automate on a SharePoint List and a SharePoint Document list
I will explain below the different code to reference for either list type
How to Post to a SharePoint Document List
Add an action called Send an HTTP request to SharePoint
- Site Address – Will be your SharePoint List
- Method – Will be POST or PATCH (I have not looked up the difference yet but both worked)
- Uri:
_api/web/lists/GetByTitle('Document List Name')/items(ID)
- Headers (you can change verbose to nometadata for cleaner output if you want):
{
"Content-Type": "application/json;odata=verbose",
"X-HTTP-Method": "MERGE",
"IF-Match": "*"
}
- Body:
{'__metadata': {'type':'SP.Data.Document_x0020_List_x0020_NameItem'},
'QuoteIDHyperlink':{
'__metadata':{'type':'SP.FieldUrlValue'},
'Description': 'Succeeded',
'Url':'http://www.google.com'
}
}
A couple things to explain in the body:
How to Post to a SharePoint List
The process is identical to above except one minor thing in the Body
Here is the correct body:
{'__metadata': {'type':'SP.Data.Document_x0020_List_x0020_NameListItem'},
'QuoteIDHyperlink':{
'__metadata':{'type':'SP.FieldUrlValue'},
'Description': 'Succeeded',
'Url':'http://www.google.com'
}
}
Can you see the difference?
It is on the first line:
Document Body Code – {'__metadata': {'type':'SP.Data.Document_x0020_List_x0020_NameItem'},
List Body Code – {'__metadata': {'type':'SP.Data.Document_x0020_List_x0020_NameListItem'},
SharePoint Document Lists use Item after the name of your library
SharePoint Lists use ListItem after the name of your list
How to Find your Decoded SharePoint List Name
After putting in all the above code before trying it out change the method to GET then run the flow
Here is a real world example of a list called CRM Order Mistakes (Look at the name after type)
How to Find your Decoded SharePoint Column Name
You can find your column name in the output above but here is another way
Go to your SharePoint Site and open your Document Library or List
Click the gear in the corner and selected Library settings then click More library settings
In this example I want to find the real name of Project ID so I will click that in the Columns section
Now in the URL you can see the real name which is Project_x0020_ID
References:
https://powerusers.microsoft.com/t5/Building-Flows/Updating-a-SP-Hyperlink-Field-using-Send-HTTP-request/td-p/648460
https://powerusers.microsoft.com/t5/Building-Flows/Need-example-of-using-Send-HTTP-Request-to-Sharepoint-to-update/td-p/825641
https://powerusers.microsoft.com/t5/General-Power-Automate/HTTP-REQUEST-TO-SHAREPOINT-document-library/td-p/668927
https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest
https://natechamberlain.com/2019/12/21/update-a-hyperlink-or-picture-column-in-sharepoint-using-microsoft-power-automate-flow/