SharePoint Designer 2013 Rest API Set URL/Hyperlink Field
I’ve been working a lot lately with the SharePoint REST API and the “Call a Web Service” Action in SharePoint Designer.
Like a lot of things with Microsoft, I found that the REST API is awesome, however, it makes certain things overly complicated to do 🙂 One of the things is setting a Hyperlink (URL) Field Value in a SharePoint list via the REST API. It wasn’t working for me and I couldn’t find much documentation on this at all so I thought I’d blog about it.
Here was my solution to set a Hyperlink field value in a SharePoint Designer Workflow calling the REST API:
1. First, you need to Create a “Build Dictionary” action and add the following to construct the metadata section of the request for your URL Item:
Name: type
Type: string
Value: SP.FieldUrlValue
That’s it for this Dictionary Item.
2. Now, create a new “Build Dictionary” action and add the following items to create the URL Field Dictionary:
Name: __metadata
Type: Dictionary
Value: The Metadata Dictionary Item you created above
Name: Description
Type: String
Value: Insert your URL’s description here
Name: Url
Type: String
Value: Insert your URL here
3. Ok so now you should have a URL Field Dictionary object that you can call in your Dictionary item that is creating your List Item. Just add an Item with your column name of type Dictionary and reference the Dictionary that we just created.
Why not JS?
Because for this requirement I had a workflow that was running doing multiple things. It runs, creates a SharePoint site, then assigns tasks in a task list on the newly created site. Hence the requirement to do this in SharePoint Designer via workflow.
Hi April
Any idea how you would set a people field with multiple users with SharePoint Designer through REST api?
April
Great articles, I see in one of the comments you had a workflow create a site and then create tasks. I have a similar scenario with a project site, my workflow creates a subsite from the top level project center and I want to update a list in the newly created project site. What method did you use to add to the task list. I am using the REST api with post but I expectedly get the authorization error.
Any advice is appreciated.
The work-around for authorization issues between sites and subsites can be found in the following two articles: http://blog.portiva.nl/2016/11/03/sharepoint-designer-call-http-web-service-to-create-item-in-other-site-collection/ and http://www.fabiangwilliams.com/2014/06/19/gotcha-on-sharepoint-designer-workflows-in-app-step/. DO NOT include the "/web" in the Permission Request XML field on the appinv.aspx page.