SOLVED

Help with the PERMISSION FUNCTION

Copper Contributor

Dear Microsoft supporting team,

 

I have created a form for conducting the internal audit among the factories. And also set up the flow to send email and notify those related department in charge person whenever someone has completed the audit with the photo attached together (the upload photo function in form)

 

In the notifying email, I have set and required them to click to the link of form response to check out the violation photos that auditor has taken to implement the improvement. In fact, it works successfully with the flow I set, and they can open the form response by clicking to the link, but the problem is the photos that auditors took could not been opened without my permission, every single photo they want to open to see is still need to get my permission, I don't know why it could happen even though I have set them as the collaborator of the form and share them the right to edit and view as well. I mean I want those people that i have shared the form could access and directly see the photos without my permission and run automatically according the flow I set. Hence, I come up with this issue and it still stuck their making my project is a bit late than schedule, I hope you guys could help me with the above problem. 

 

Thank you very much!

 

Jason

2 Replies
best response confirmed by jason2991 (Copper Contributor)
Solution

@jason2991 when a file is uploaded in Forms it saves it to your OneDrive (as the owner of the form). What you then need to do in your flow is to copy it from there to your SharePoint list so it can be viewed by everyone. The steps in the flow are quite complicated but hopefully you can follow my text and images below.

 

First, make sure the attachments column is visible in your SharePoint list:

0-SP-Attachments.png

 

Next, in the flow after the trigger and the Get response details action you need to add a Parse JSON action:

1-trigger-ParseJSON.png

 

For the content box select the file upload question from your form. In the Schema paste the following:

 

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "link": {
                "type": "string"
            },
            "id": {
                "type": "string"
            },
            "type": {},
            "size": {
                "type": "integer"
            },
            "referenceId": {
                "type": "string"
            },
            "driveId": {
                "type": "string"
            },
            "status": {
                "type": "integer"
            },
            "uploadSessionUrl": {}
        },
        "required": [
            "name",
            "link",
            "id",
            "type",
            "size",
            "referenceId",
            "driveId",
            "status",
            "uploadSessionUrl"
        ]
    }
}

 


Next add a OneDrive action Get file content using path and select the path to the folder where the attachments are stored (in my case the form is called Ticket). The path will be /Apps/Microsoft Forms/[YourForm]/Question/

 

But then after the / you need to add the following expression: first(body('Parse_JSON'))?['name']

 

2-getFifleContentOneDrive.png

Next you need to account for the situation where a file is not uploaded. So in the Settings for the Get file content action select Configure run after and select Has failed as well as Is successful:

2a-configureRunAfter.png

 

Next, add an Office 365 users Get user profile (v2) and in the User (UPN) field select Responder's Email from the dynamic content.

 

3a-configureRunAfter.png

 

Next, add a SharePoint Create item action and select the appropriate fields from the dynamic content. 

 

Next add a Delay - 10 seconds is enough - so that the Create item action has time to complete for the attachment is added:

 

3-createItem.png

 

Next add an Apply to each control and from the dynamic content select Body from the Parse JSON section.  Next add a SharePoint Add attachment, select the site and list and the ID from the Create item section of the dynamic content. For the filename select name from the Parse JSON section of the dynamic content. For the File Content select File content from the Get file content using path section of the dynamic content.

 

4-addAttachment.png

 

In my form I'd uploaded an image called japanese-garden-500.jpg

 

5-formsFile.png

 

After the flow has run the item in the SharePoint list is updated with the attachment icon. And when you edit the item it displays the filename and adds to it the name of the person who has uploaded it. Any user who can view the form just needs to double click the attachment to download it.

6-SP-list-Result.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

Hi @Rob Elliott,
Thank you very much for your help, I will try it out.
1 best response

Accepted Solutions
best response confirmed by jason2991 (Copper Contributor)
Solution

@jason2991 when a file is uploaded in Forms it saves it to your OneDrive (as the owner of the form). What you then need to do in your flow is to copy it from there to your SharePoint list so it can be viewed by everyone. The steps in the flow are quite complicated but hopefully you can follow my text and images below.

 

First, make sure the attachments column is visible in your SharePoint list:

0-SP-Attachments.png

 

Next, in the flow after the trigger and the Get response details action you need to add a Parse JSON action:

1-trigger-ParseJSON.png

 

For the content box select the file upload question from your form. In the Schema paste the following:

 

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "link": {
                "type": "string"
            },
            "id": {
                "type": "string"
            },
            "type": {},
            "size": {
                "type": "integer"
            },
            "referenceId": {
                "type": "string"
            },
            "driveId": {
                "type": "string"
            },
            "status": {
                "type": "integer"
            },
            "uploadSessionUrl": {}
        },
        "required": [
            "name",
            "link",
            "id",
            "type",
            "size",
            "referenceId",
            "driveId",
            "status",
            "uploadSessionUrl"
        ]
    }
}

 


Next add a OneDrive action Get file content using path and select the path to the folder where the attachments are stored (in my case the form is called Ticket). The path will be /Apps/Microsoft Forms/[YourForm]/Question/

 

But then after the / you need to add the following expression: first(body('Parse_JSON'))?['name']

 

2-getFifleContentOneDrive.png

Next you need to account for the situation where a file is not uploaded. So in the Settings for the Get file content action select Configure run after and select Has failed as well as Is successful:

2a-configureRunAfter.png

 

Next, add an Office 365 users Get user profile (v2) and in the User (UPN) field select Responder's Email from the dynamic content.

 

3a-configureRunAfter.png

 

Next, add a SharePoint Create item action and select the appropriate fields from the dynamic content. 

 

Next add a Delay - 10 seconds is enough - so that the Create item action has time to complete for the attachment is added:

 

3-createItem.png

 

Next add an Apply to each control and from the dynamic content select Body from the Parse JSON section.  Next add a SharePoint Add attachment, select the site and list and the ID from the Create item section of the dynamic content. For the filename select name from the Parse JSON section of the dynamic content. For the File Content select File content from the Get file content using path section of the dynamic content.

 

4-addAttachment.png

 

In my form I'd uploaded an image called japanese-garden-500.jpg

 

5-formsFile.png

 

After the flow has run the item in the SharePoint list is updated with the attachment icon. And when you edit the item it displays the filename and adds to it the name of the person who has uploaded it. Any user who can view the form just needs to double click the attachment to download it.

6-SP-list-Result.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

View solution in original post