This post explains how to update a Hyperlink Column in SharePoint Online using Power Automate. Unlike most field types, the hyperlink column has two components, the link address and the alternative text:
But when you try to create or update an item with a Hyperlink field in Power Automate, you are given only one field to populate:
The link text then becomes both the hyperlink and the descriptive text. If you have a long URL, this can ruin the look of your list and be confusing for users.
Create Hyperlink by using the Send an HTTP Request to SharePoint action
The solution is to use the “Send an HTTP Request to SharePoint” action to set both the URL and the Alternative text. This action would normally follow a Create Item action.
Select your Site Address and set the method to POST then set the URI to:
_api/web/lists/GetByTitle('Hyperlink Test')/items(ItemID)
Modify the above to contain your list name in place of “Hyperlink Test” and replace ItemID with the ID of your item, or dynamic content which references it.
Next set the Headers to the following:
{ "Content-Type": "application/json;odata=verbose", "X-HTTP-Method": "MERGE", "IF-MATCH": "*" }
You can copy and paste the JSON above if switch the headers to text mode:
Next is where the fun begins, an example HTTP Body looks like this:
{ "__metadata": { "type": "SP.Data.Hyperlink_x0020_TestListItem" }, "Link": { "Description": "Microsoft", "Url": "https://www.microsoft.com" } }
But to make it easier for you, you can just type your list name, link description and Url into the form below and the correct code will be generated for you.
Copy the code generated above into the HTTP Body and then replace the static values with your dynamic content. The complete action looks like this:
Give it a try and see how you get on. It is quite straightforward. I hope that in the future the standard actions will handle creating and updating Hyperlink fields better and there will be no need to do this in the future.
Maeva says
Thank you! That was easy to follow and understand and it worked brillantly!
sandra_nz says
Question: How would this work if you want to create a link using the “Link to item” dynamic content? For example, I have a flow where after an item is submitted in List A, a new item is created in List B. I then want to update a hyperlink column in List A to have a link to the newly created item in List B.
Roland Daane says
I tried this but keep getting the error A type named ‘SP.Data.testListItem’ could not be resolved by the model. When a model is available, each type name must resolve to a valid type.
Christoph says
This solution is referenced so much around the internet, but I cannot get it to work. No matter what I try, I always get the same error message like Roland. And for that, no real help is available. Stupid Microsoft, it should be such a simple feature…
Paulie says
Christoph – happy to have a look with you via a teams session to see where it is going wrong. Please use the contact form to get in touch.
Ademola says
Hi, thanks so much for this. Just want to add that for document libraries, a person will need to use SP.Data.Hyperlink_x0020_TestItem instead of SP.Data.Hyperlink_x0020_TestListItem . Every other thing works excellently well. Thank you!
JCBq says
I had the same issue and found an answer
I suggest you to verify your list name in the code
Just go to: (your sharpoint URL)/_api/web/lists/GetByTitle(‘Your list name’)
Then check the item “ListItemEntityTypeFullName”, apparently even an uppercase can do the difference, so if you have renamed your list after its creation, maybe the error come from here
I’m so happy it works ^^
Mel says
Thanks so much! This makes the SharePoint List so much more usable.
I did have the dreaded, “A type named ‘SP.Data.’ could not be resolved by the model. When a model is available, each type name must resolve to a valid type.”, because my list name had been changed at some point.
To resolve and future proof against name changes, I get the “Full List Name” before the apply to each loop and use it in the body as an output of a compose.
For reference see:
https://vblogs.in/solved-a-type-named-sp-data-listname-could-not-be-resolved-by-the-model/
Bruce Altner says
Everything seems to be working for me except for the target Url, which is a document library, not the list where the hyperlink lives. I tried Ademola’s suggestion (7/18/22) to replace “_TestListItem” with “_TestItem” for the type, which in my case was replacing “_DataListItem” with “_DataItem” but this gave me an error: “A type named ‘SP.Data.Suppliers_x0020_DataItem’ could not be resolved by the model.” I’m assuming that the Url specified should point to the library and folder where the referenced document is intended to be stored, right?
Skweekah says
This is brilliant. Well explained. To the point. Everything I was looking for.
Bruce Altner says
I solved the Url issue mentioned above but now have figure out how to handle a “Network error when using Patch function. Conflicts exist with changes on the server” error. I think this is happening because I’m calling the flow within an edit form (which allows to make other changes to the list item). The error occurs on submitting the form after the flow has run, so there are two different forces at work to change the hyperlink field, causing a conflict.
Bruce Altner says
Fixed above problem by removing the data card in the form that originally updated the field that contains the hyperlink. Since the workflow does that, the form doesn’t need to anymore. Nice solution!!!
Bruce Altner says
FYI, I my app also allows deleting the uploaded file. This method works equally well for removing the link by passing in empty strings fro the Url and Description. (A separate workflow deletes the file.)
Paulie says
Well done Bruce, sounds like you’ve worked everything out nicely.
Paul Stone says
This was just what I was looking for and it works well… unless you called your column Folder to start with then renamed it! LIke the comments above you can find the original field name but don’t use a reserved word I guess!
Tanya says
I had this working to update a document library column with a link to a corresponding list item. However, when I changed the flow to use a new site/list, it is giving me a 404 error…except that it is adding the link, but not the description. (Long link should be showing as a number/friendly link).
Any ideas why this would be? Thanks
DM says
Thanks so much for this! I spent hours trying to get this to work reading this atricle and others and kept getting the SP.Data.’ could not be resolved by the model error. I read the blog:
https://vblogs.in/solved-a-type-named-sp-data-listname-could-not-be-resolved-by-the-model/
post in the comments here and suddenly realized I changed the name of my list. but, The “Uri: _api/lists/getbytitle(‘Display Name of List’) needs the new list name but the Send HTTP request wanted the old list name in the body/JSON.
Lesson learned… Never change your list name unless you like headaches.
Tanya says
I had a similar name issue to fix my troubles noted above. The list name has spaces, and you need to use _x0020_ in the json portion but spaces in the list name above. Why would it be consistent?!
mehmet says
Thanks for the article.
It helps a lot, when I do the exact same like you it works. However I cannot pass a variable which has the url value instead of typing “https://microsoft.com”.
My string variable has the url value.
Has anybody been able to do that?
Thandazani Mbutho says
Great stuff, real make life easier especially with the form functionality
Dwain says
Has anyone built a reusable Instant Flow that can properly update any SharePoint list Hyperlink field? Pass the Site (url), List (name), Field (name), URL, and Text and the flow to lookup the necessary parameters, verify the target field is indeed a hyperlink field, and perform the update?
I have started one, and I have the flow retrieving the List information, then doing another call for the list fields, but I am having trouble parsing the field list to select (find) the field I want, verify the type, retrieve the internal name, and perform the update. I have several fields across several lists I need to do this on (low volume), and an abstracted method to do it is much easier.
Very sad this basic feature is not included in the Create Item and Update Item function yet.
Scott says
Worked great! Thank you for the clear instructions and the great template to create the code using my list.