Solved

Does an action (or actions) exist in Nintex Workflow to copy a file from Nintex SharePoint 2013 on-premise to a SharePoint online tenant which also has Nintex workflow online enabled?

  • 20 March 2017
  • 4 replies
  • 10 views

Hi,

 

I have a customer requirement to copy a file from a SharePoint 2013 on-premise instance to a SharePoint online instance, both installed with Nintex Workflow Enterprise.

 

The file should be copied complete with metadata but version history is not required.

 

I'm wondering what Nintex actions support such a scenario? Or if it is more custom but still quite feasible?

 

Thanks,

Sean

icon

Best answer by TomaszPoszytek 28 March 2017, 10:05

View original

4 replies

Userlevel 7
Badge +17

No, but I would try to do that this way:

  1. Configure your on-premise workflow to be able to be triggered by the external start.
  2. Then create your O365 workflow where you obtain rtFa and FedAuth cookies (https://community.nintex.com/community/build-your-own/nintex-for-office-365/blog/2017/02/09/working-with-security-credentials-requestdigest-fedauth-rtfa?sr=search&searchId=268d440c-3131-49d3-836f-5854a80b4e8f&searchIndex=0)
  3. and then call the on-premise workflow passing the cookies values together with ex. path to a library where you want your file to be uploaded.
  4. In on-premise workflow, that will be triggered externally, get the cookies and add the action to call web service.
  5. You will then have to configure the action to call your O365 REST API:
    1. https://msdn.microsoft.com/en-us/library/office/dn769086.aspx
    2. https://msdn.microsoft.com/en-us/library/office/dn292553.aspx#Anchor_1
    3. You should be able to use your cookies instead of "X-RequestDigest" in your request header. To do that create a variable: "cookie" and set its value to: "FedAuth={value};rtFa={value}"
  6. The action should be configured this way:
    1. Headers:
      1. accept: application/json;odata=verbose
      2. cookie: FedAuth={value};rtFa={value}
    2. Body:
      1. Binary contents of your file

Regards,

Tomasz

Thanks Tomasz, looks very complex!

I can see how the binary of the file is passed this way, how would you pass metadata using something similar?

Userlevel 7
Badge +17

I know... But at the moment nothing simpler comes to my mind. I mean - I would try to go that way. Imho it should work and do what you expect even though its complex.

On the other hand as long as you are on premises you can always ask a developer to write you your own, specialized and dedicated action for Nintex Workflow 2013, that will receive some params and uploads your file. But in the end this action will be just a prettier representation of what I wrote above

Back to the metadata - as that method allows only file contents to be passed in the request body, I'd hit with another web service call now to the list REST API to update the item you have just created and to set its library properties, ex.:

method: POST
body: { '__metadata': { 'type': 'SP.List' }, 'Description': 'My list description', 'Title': 'Test', 'OtherInternalName': 'OtherValue' }‍‍

Source: https://msdn.microsoft.com/en-us/library/office/dn292552.aspx#Anchor_2

One more thing - you don't need to start your logic from O365. Following steps to obtain FedAuth and rtFa cookies you will notice that the first step is to send "SAML Request" - you can do it from on premise workflow, providing your "onmicrosoft" login and password. So in the end you can simplify it a bit:

  1. Use https://community.nintex.com/community/build-your-own/nintex-for-office-365/blog/2017/02/09/working-with-security-credentials-requestdigest-fedauth-rtfa to get the cookies for O365 tenant following steps from your on premise workflow;
  2. Set action to call O365 library REST API as I wrote above so that it will upload your file;
  3. Set action to call O365 library (list) REST API again to set created file metadata.

Done!

Regards,

Tomasz

Userlevel 7
Badge +17

Sean Swords‌ have you solved that issue? Can you mark the question as "Answered" (to do that you mast mark one from the answers as "Correct"), or do you need more support?

Regards,

Tomasz

Reply