Integrating Nintex Automation Cloud with SharePoint Online allows you to effectively manage content types within your SharePoint lists. This guide will walk you through the process of retrieving and updating content types using SharePoint web services.
Overview
In this article, we'll cover two main actions:
-
Getting the Content Type of a SharePoint list item.
-
Updating the Content Type of a SharePoint list item.
Step 1: Get Content Type of SharePoint list item
Configure the Call a SharePoint Web Service action to Get Content Type
-
Create a new workflow in Nintex Automation Cloud or edit an existing one.
-
Connection: Ensure the SharePoint online connector used has the correct permissions in SharePoint to execute the desired SharePoint RESTAPI.
-
Add a Call a SharePoint web service action to your workflow.
-
Set the Request Type to HTTP GET.
-
Enter the following URL to retrieve the content type for a specific list item:
https://SharePointSite.sharepoint.com/_api/lists/getbytitle('ListTitle')/items(ItemID)

Save Results in an Object Variable
-
Add an Object Variable to your workflow to store the response from the Call a SharePoint web service action.
-
In the settings of the Call a SharePoint web service action output, select the option to save the response to the object variable.

Query the JSON Response and Get Content Type ID
-
Add 2 Query JSON action to your workflow.
-
Set the JSON Source to the response content from the object variable returned by the SharePoint Call a Web Service action.
First Query JSON
-
Configure the JSONPath expression to extract the type of content type:
d.__metadata.type

-
Store the first results in a text variable.
Second Query JSON
-
Configure the JSONPath expression to extract the content type id:
$..ContentTypeId

-
Store the first results in a text variable.
Step 2: Update Content Type in SharePoint List
Configure the Call a SharePoint web service action to Update the Content Type
-
Add another Call a SharePoint web service action to your workflow to update the content type.
-
Set the Request Type to MERGE.
-
Enter the same URL as before:
https://SharePointSite.sharepoint.com/_api/lists/getbytitle('ListTitle')/items(ItemID)

Set Request Headers
-
Add the following headers to your request:
-
Accept: application/json;odata=verbose
-
Content-Type: application/json;odata=verbose
-
If-Match: *
-

Define Request Content
-
In the Request Content section, enter the following JSON, replacing txtContentType_Type and txtContentTypeID with the actual variable of the content type from your Query JSON results:

By following these steps, you can easily get and update content types within SharePoint lists using Nintex Automation Cloud.