0

I have a form that asks the user to upload a file, and I want the uploaded file to appear in an "Attachment" column on my SharePoint list. This was easy enough to do when the form was stored in my OneDrive, but moving the form to a Sharepoint site has made this significantly more difficult to figure out.

When the form was stored in my OneDrive, the flow looked like this: When a new response is submitted > Get response details > Search for users (V2) > Create item > Parse JSON > Get file content using path > Add attachment.

The seemingly obvious solution was to use the "Get file content using path" action that connects to SharePoint rather than the one that connects to OneDrive, but that doesn't work. In my "Add attachment" action, there is no dynamic content from the "Create item" action, which seems to be necessary for linking the attachment to the correct item. In addition, there is no appropriate dynamic content to fill the "File Content" field in the "Add attachment" action, which seems to be necessary for actually linking the file.

When the form was in my OneDrive, I used this YouTube tutorial to write the flow that I needed, but it no longer applies now that the form is stored on a Sharepoint site. A solution shared in the comments seems to be exactly what I need, but it's not explained in a way that's easy for the layman to understand and apply:

Actually, the "Get File" SharePoint action doesn't work to move those files attached to Group Forms because the "id" of the file that's provided in the JSON from the response details isn't the same as the "id" needed by the Get File action. You actually need to use the OneDrive actions to "Get file metadata" of the attachment, feeding it the "driveId" and "id" (concatenating them with a . in between) from the JSON, then user the Id output of that action with the OneDrive "Get file content" and THEN the SharePoint "Create file" action. It's a pain, but does work.

I can't figure this one out. It's counterintuitive to me that writing a flow to link my SharePoint list to a form stored on my SharePoint site is more difficult than linking my SharePoint list to a form that's stored in my OneDrive.

1 Answer 1

0

Check out this video: https://www.youtube.com/watch?v=K-hiDOPAG-4&t=756s

He solves it another way. He doesn't deal with group forms until near the end, so you will need to watch all the way through. I am new to Power Automate as well and I found it very instructive.

I picked up enough to piece together my own solution. I create a SharePoint list item, attach the files (if they exist), and attach them to an email (again, if they exist). I didn't bother with a separate loop for either. I attached to the list item and appended it to the array variable inside the same loop.

I’ll try to summarise what I did in text. You will need to watch the video to fill in the blanks. My explanation will be rough, but as you've already been waiting nearly a month for any reply, I guess it's better than nothing.

•   Trigger: When a new response is submitted on a MS form (duh!) You will need to paste in the long form ID from the form URL using Enter custom value.

•   Initialise variable: Name: VarFiles, Type Array

•   Apply to each response using List of Respondents 

      o Get response details (from  MS form) (use ID again)
      o Create a new item in SP list
  
      o Condition: Attachments field is not null

           If yes (there are attachments)

            o   Apply to each attachment using json reference

               o    Get file content using path (SP)
               o    Append attachment to VarFiles
               o    Add attachment to list item

            o   Send email with VarFiles used for attachments 

           If no (no attachments)
            o   Send email without attachments

I use Send an Email (V2), Office 365.

Like you, I have been struggling with this problem - adding attachments from group MS forms to SharePoint lists and emails. I came across your post, checked out the video you mentioned, and didn't get far with 'Get file metadata'.

I didn't use the OneDrive "Get file content" and 'Create file'. I used the SharePoint "Get file content using path'. I have a feeling using the SP 'Get file content' using an ID might be more robust, but this works for now. I think he meant 'Create item' instead of 'Create file'.

Nice guy, though. I posted under the video asking for elaboration and he replied within the day asking which comment I was referring to. He may follow up with more on using metadata.

I hope this helps.

Dave

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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