locked
How to get sharepoint 2010 workflow .xoml file from sharepoint online Using PowerShell RRS feed

  • Question

  • Hi,

    i need to retrieve SharePoint 2010 xml file from sharepoint online. I can able to get from on-prm system but i couldn't able to get it from sharepoint online.

    Saturday, July 25, 2020 3:34 PM

All replies

  • Hi Kanagaraj Neelamegan,

    SharePoint online did not expose SSOM so we think there is no oob functionality to get this xoml file. We found that we can export this file from SharePoint Designer: 

    For more details, please refer to : https://www.linkedin.com/pulse/export-import-sharepoint-designer-workflow-vipul-jain/

    By tracing the request via Fiddler, we find that the behind request is :

    So we can simulate this process :

    $Username='abc@xxx.onmicrosoft.com'
    $Password = 'xxxxx'
    
    #region Credentials
    [SecureString]$SecurePass = ConvertTo-SecureString $Password -AsPlainText -Force 
    [System.Management.Automation.PSCredential]$PSCredentials = New-Object System.Management.Automation.PSCredential($Username, $SecurePass) 
    #endregion Credentials
    
    #connect to site
    $targetSiteUrl='https://xxx.sharepoint.com/sites/sbdev'
    Connect-PnPOnline -Url $targetSiteUrl -Credentials $PSCredentials
    
    # get cookie
    $ctx = Get-PnPContext
    $creds = $ctx.Credentials
    $authenticationCookies=$creds.GetAuthenticationCookie($targetSiteUrl,$true)
    
    
    # Get xoml
    $url="https://xxx.sharepoint.com/sites/sbdev/_vti_bin/_vti_aut/author.dll"
    
    $request = [System.Net.WebRequest]::Create($url)
    $Request.Method = 'POST';
    
    $Request.ContentType = "application/x-www-form-urlencoded"
    
    $Request.Headers.Add("Cookie", $authenticationCookies)
    $Request.Headers.Add("X-Vermeer-Content-Type", "application/x-www-form-urlencoded")
    $Request.Headers.Add("Accept-Language", "en-us, en;q=0.1");
    
    $postData = "method=get+document:15.0.0.4455&service_name=/sites/sbdev&document_name=_catalogs/wfpub/Collect+Signatures+-+SharePoint+2010/Signatures_1033.xoml&old_theme_html=false&force=true&get_option=none&doc_version=&timeout=0&expandWebPartPages=true";         
    $Body = [byte[]][char[]]$postData;
    
    
    $Stream = $Request.GetRequestStream();
    $Stream.Write($Body, 0, $Body.Length);
    
    $response = $request.GetResponse()
    $requestStream = $response.GetResponseStream()
    $readStream = New-Object System.IO.StreamReader $requestStream
    $data=$readStream.ReadToEnd()
    
    $data

    We can get the xoml file from above result. 

    This “SharePoint Server 2010” Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.

    Best Regards,

    Baker Kong


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !


    Monday, July 27, 2020 7:33 AM
  • Hi Kanagaraj Neelamegan,

    We have not heard from you for a long time. Is above info helpful to the issue? If it has been resolved, it's appreciated that you can mark it as Answer so that others who stuck in similar issue could get answered quickly.

    And we'd like to notify you that This forum will be locked down, if you still have issues about this question, you can continue to post in here before 8/10/2020. It is recommended to create a new question on Microsoft Q&A, we will continue to support you on the new home.

    Best Regards,

    Baker Kong


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Wednesday, August 5, 2020 2:44 AM