Can "Upload file from URL" destination be a SharePoint folder?

8012
34
Jump to solution
06-20-2023 02:00 PM
Tiff
by
Frequent Contributor

I have a flow set up that starts with a Survey123 submission trigger, generating a feature reporting and then uploading that to OneDrive and subsequently sending an email.

This project is highly collaborative and I would like the reports to reside in a shared SharePoint folder rather than my personal OneDrive. I have not been able to find any resources on how to do so/whether it's possible using the Destination File Path parameter. Any assistance is appreciated!

1 Solution

Accepted Solutions
Beard_Greg
Occasional Contributor

Oh no! Sorry about that. You got me curious so I looked around and found some things and built one. Once again, @IsmaelChivite coming to the rescue.

Main Source for flow (Source 1): Survey123 Create Report action in Microsoft Power Automate (Preview)

Answered SharePoint Portion (Source 2). Ismael suggested transferring from OneDrive to SharePoint: Use Power Automate with Survey123 and SharePoint 

So based on what I found, it wasn't quick and easy to get the PDF report into SharePoint. However, it was super easy getting it into OneDrive. The flow I will be showing: When a Survey123 is submitted, create a report, download report into OneDrive, copy the data from OneDrive into SharePoint, sends email with attachment, deletes OneDrive file.

Overview:

Beard_Greg_0-1689915510794.png

Step1: When a survey response is submitted. Choose your survey123.

Step 2: Create Report. For this to work, you will need to have already created a report template on the Data tab on the Survey123 Website. Source 1 has a video. First two questions are your Survey123 information. If you've create a report template, it should be listed as a drop down. Object ID is the ObjectID of the survey123 so that should be simple. Report Name is what you want to call the file. Make sure it is unique! Change the format to PDF.

Beard_Greg_2-1689915856649.png

Step 3: Upload Report into OneDrive. Source 1 does a really good job explaining this. I chose to put mine in a specific folder. Hypothetically if this works perfectly every time, this folder will always be empty. I changed my Overwrite output to "Yes" just in case, but it works with No as well. "Yes" helps with testing. It's transferring to SharePoint so it doesn't matter too much especially if you give the file a unique name. 

Source URL = Use URL - URL of the first result file from Dynamic Content 

Destination File Path: Where you want it saved. I added Name - Name of the first result file from Dynamic content

Beard_Greg_4-1689916207548.png

Step 4: Get the File Content so that you can transfer to SharePoint. 

File Path: Use the dynamic content Upload file from URL - Path

Beard_Greg_5-1689916604739.png

Step 5: Create File (SharePoint). Site Address / Folder Path for where you want it saved.

File Name you have some options, but I just went with the name generated by Step 3. 

File Content: Use Dynamic Content to find Get file content using path - File Content (second image).

Beard_Greg_11-1689917982910.png

Beard_Greg_7-1689917016066.png

Step 6: Send Email

Attachment Name / Content: I used the same fields I used in Step 5 for creating the file in SharePoint

Beard_Greg_10-1689917176891.png

Step 7: Delete file (OneDrive)

The ID is from Upload file from URL - ID (The unique identifier of the file or folder)

Beard_Greg_9-1689917086094.png

Hope this helps!

View solution in original post

0 Kudos
34 Replies
SeanKMcGinnis
Esri Contributor

@Tiff - I recently built a flow that does the steps you are looking to accomplish. There are a couple extra steps needed, but it is pretty straight-forward.

The first thing I do is use an HTTP action to get the report from the URL as defined by the Create Report action.

Then use the SharePoint 'Create file' action to write the body of the HTTP request as the File Content.

Below are the two steps from the flow:

Screen Shot 2023-06-20 at 5.14.08 PM.png

Hopefully this helps and please let me know if you have any other questions.

-sean
Sean McGinnis - ArcGIS for Microsoft 365 Product Manager
RobertAnderson3
MVP Regular Contributor

Oh this is awesome, I appreciate this step! I had been using the flow from Ismael that uploads to OneDrive, then gets content, then creates the SharePoint file and then deletes from my OneDrive but this makes way more sense!

RobertAnderson3_0-1687346298191.png

 

SeanKMcGinnis
Esri Contributor

@RobertAnderson3 - glad it helped!

-sean
Sean McGinnis - ArcGIS for Microsoft 365 Product Manager
Tiff
by
Frequent Contributor

Thank you so much! I will try this out. Related question - is it possible to have the folder path be in someone else's OneDrive and not your own? @SeanKMcGinnis 

0 Kudos
SeanKMcGinnis
Esri Contributor

@Tiff - I am not 100% sure. But I think if you have permissions to write to the directory you should be able to create the file.

-sean
Sean McGinnis - ArcGIS for Microsoft 365 Product Manager
0 Kudos
Beard_Greg
Occasional Contributor

@Tiff,

You can share your flow with the person that owns the OneDrive folder and they can make the connection for you if needed.

0 Kudos
Tiff
by
Frequent Contributor

Thanks @Beard_Greg! This is something I am looking into possibly because I may want to transfer the flow to someone else in the future.

0 Kudos
Tiff
by
Frequent Contributor

Hi @SeanKMcGinnis, thank you again for this. I am still trying to gain access to the correct SharePoint folder so I have not yet been able to test this out. I just have a couple questions:

1) Can this feed into additional actions of 1. getting the file content by path and 2. sending an email with the PDF generated?

2) We have an older version of SharePoint as well; do you know if this only works with modern SharePoint or possibly the one we are using as of 2018?

0 Kudos
Beard_Greg
Occasional Contributor

@Tiff,

I might not be understanding the question. Are you trying to get the URL and / or the PDF to send in an email? If so, both are possible.

1) I don't have a flow screenshot using the ArcGIS Actions method, but I found a popular guide that uses a similar method Shawn mentioned. Survey123 Tricks of the Trade: Working with attachments in Microsoft Power Automate. If you need to generate a URL, you can use "SharePoint's Create Sharing link for file or folder".

2) I'm using 365 so I can't help you there.

 

 

0 Kudos