I'm trying to create a workflow for a list that will automatically take two values from an XML added to the list and set them as variables in SPD. The ultimate goal of this is to assign tasks to individuals whose names would be in the XML. The XMLs will always be formatted the same way.

How can I take two values from any XML added to a list and store them as variables in SPD?


Unfortunately, It's impossible to read XML file content using SharePoint Designer workflow.

Note: you can create a data source from XML file using SharePoint Designer but you can't use it in workflow!

Alternative solutions:

  1. Develop a custom workflow via Visual Studio to can read the XML file, then extract it to variables as you need.
  2. Convert your XML files to list using PowerShell
    • Then read the corresponding value directly from the list instead of XML file.
  3. Use a 3rd party tool like harepoint that may help to process XML file in SharePoint Workflow.

PowerShell Script to convert XML to list

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Set these two variables accordingly $WebURL  = "http://project.crescent.com/" $ListName = "External Projects" $XMLFilePath = "D:\data\ExternalProjects.xml"

#Get the Web $web = Get-SPWeb $WebURL
#Get the List $ProjectList = $web.Lists[$ListName]

#import xml file [xml]$ProjectXmlFile = Get-Content $XMLFilePath

foreach ($XMLProject in $ProjectXmlFile.projects.project)  {
        $NewProject = $ProjectList.Items.Add()

        $NewProject["Project ID"] = $XMLProject.id
        $NewProject["Description"] = $XMLProject.description
        #Set the People Picker Field
        $NewProject["Project Manager"] = $web.EnsureUser($XMLProject.manager)
        $NewProject["Cost"] = $XMLProject.cost
        $NewProject["Start Date"] = $XMLProject.startdate


        Write-Host "Project $($XMLProject.id) has been Added to External Projects list!"  }

Read more at read from XML and import to SharePoint list

  • 1
    I've decided to replace my use of XML files with SharePoint forms, but your answer was very detailed and will certainly be of use to someone. Thank you for your time. – Rivei Jun 21 '17 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.