Solved

How to get the URL of a file Saved to OneDrive

  • 5 January 2021
  • 6 replies
  • 60 views

Hi everyone.

Here is an explanation of what I am trying to achieve using NWC and a form to start the workflow.

1) User uploads 1 file using the Form -> Submit
2) Save the file to OneDrive (This can be achieved)
3) Email the URL of the document in OneDrive to someone

 

I can't seem to find a way within NWC to retrieve the URL.
One of the solutions I tried was to extract the File Name of the attached file, but this also seems to be unachievable?

Thanks in advance 😉

icon

Best answer by leighburke 5 January 2021, 22:42

View original

6 replies

Userlevel 5
Badge +13

@Bradley You can use the copy file action(https://help.nintex.com/en-US/nwc/Content/Designer/Actions/OneDriveforBusiness-CopyaFile.htm) instead, that stores the file path. Alternatively you can be log the fileupload variable to the instance details and check the format of the variable data. This should then allow you to use a regular expression to extract filename out.


 

Thanks @leighburke , that was a great answer.
Unfortunately when testing the copy file action and using a File Variable as the source, I receive an error when executing. "source path or file variable required"



Here is the configuration used.



Is this possibly a bug? 

Thanks again!


 

Userlevel 5
Badge +13

@Bradley  It should work I just tested and confirmed, is that the correct file variable? Otherwise I would check out the path field

Thanks @leighburke , your assistance helped me get to the end goal, which was to get a sharable Url to a document uploaded to OneDrive.

To summarize the actions used, for others who might be interested.

1) Using a form to upload a document


2) Used the "OneDrive - Copy a file" action, storing the "new path as a variable"


3) Used the "OneDrive - Share a file link" action using the path returned from the previous step, and storing the "download" or "view" link as a variable.

This returned a valid url to the document, which could then be shared via email.



 

Userlevel 5
Badge +13

@Bradley Awesome, the other option would of been using the path from the copy action and a build string action to make a file url, but the sharing a file link is the best option.

@leighburke , I originally tried the approach of building a Url, however as I learned today, to share files stored on OneDrive, it is not possible via a Url such as [Base_Path]/Location/Document. OneDrive requires a shared link to be created, luckily the "Sharing file link" action exists.

Again thanks for your assistance!

Reply