web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Microsoft Form upload ...
Power Automate
Answered

Microsoft Form upload does not preview image when copied to SharePoint

(0) ShareShare
ReportReport
Posted on by 299

My goal is to push an uploaded .jpg file (Cover Photo) from Microsoft Forms, to my SharePoint site path (Site Assets/ListsImages/)

 

A user fills out a Microsoft Form and is invited to upload a file (in my case its called Cover Photo).

kensley_0-1616700568018.png

 

From within my Power Automate app, I'm first initializing a variable for use with my Cover Photo like so. This step is probably not important for my current issue.

kensley_2-1616701127640.png

 

Next, within my parent apply to each loop, I created a Compose for my Cover Photo. I'm using a json() expression to get access to all the array data points from this uploaded file (i.e. name, link, id, etc...)

kensley_3-1616701249324.png

(outputs):

 

 

[
 {
 "name": "alex-motoc-v77vc1iAK18-unsplash_Kensley Lewis 1.jpg",
 "link": "https://my-site/personal/user-company/Documents/Apps/Microsoft%20Forms/Easy%20to%20make%20meals%20for%20a%20Healthy%20Lifestyle%20(Person/Question/alex-motoc-v77vc1iAK18-unsplash_user%20name%201.jpg",
 "id": "015QKZ45L6HJRHQ5O4XBBKIILRETASGXPT",
 "type": null,
 "size": 4325765,
 "referenceId": "015QKZ45JFS6ROS4U5X5CK52U5GIAJNC5M",
 "driveId": "b!QsOv-uYEF0Sw8krNrbFtiGy5Cpgf9XtJm75K5Uyw_90Ix65wQ1NHR7c1Mq6zD_TN",
 "status": 1,
 "uploadSessionUrl": null
 }
]

 

 

Next, I'm then setting up a condition to check if Cover Photo Exists like so..., then do something...

kensley_4-1616701540413.png

If Cover Photo Exists, then as shown below, I have an Apply to each to loop through Cover Photo array.  As you can see,

  • I am getting the link from the array - Compose
  • I then get the name from the array - Compose

 

 

Replace(items('Apply_to_each_to_loop_through_Photo_Cover_array')?['name'],' ','_')

 

 

  • I then Create file (SharePoint) to my SharePoint site that takes both above Compose Outputs. Diagram is shown in detail below....

kensley_5-1616701630864.png

(in detailed)

pa-create-file.png

When I run my PA app, it does copy my image over to my SharePoint directory....

 

kensley_0-1616704187882.png

...but the file preview for the image is corrupted. I can't preview the image in SharePoint (unlike other images I can preview if they were uploaded manually to SharePoint).

 

kensley_0-1616703428399.png

Is there something I am missing from my steps? Or perhaps there is another way I can achieve this same goal?

Categories:
  • CU09091757-0 Profile Picture
    299 on at

    Here's one clue...its telling me that only 1KB of my file copied into SharePoint.  What should I consider looking at next?

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @kensley 

     

    I don't see where you are getting the file content from?  You actually need to retrieve this.

     

    You could add in the following:

    DamoBird365_0-1616705637407.png

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here

  • CU09091757-0 Profile Picture
    299 on at

    Thanks for the feedback.

    The user uploads a file through Microsoft Forms.

    I'm then using Power Automate to send that upload file directly to SharePoint.

    I'm not sure if I need 'Get file content', sense all I am doing is trying to put the file in SharePoint...?

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @kensley 

     

    Sorry my bad but looking at your array you have a link to a jpg and no sign of file content.

     

    DamoBird365_0-1616705981565.png

    What have you supplied in the file content expression here?  It literally needs to be file content.  If you download the saved jog to your pc and open it in notpad++ or similar you will be able to see what you have saved inside the file.  I guess it isn't a jpg.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here

  • CU09091757-0 Profile Picture
    299 on at

    Understood.

    That output value is is point towards...

    outputs('Compose_to_get_link_array_item_from_Photo_Cover')
     
    And that Compose is pointing towards...
    items('Apply_to_each_to_loop_through_Photo_Cover_array')?['link']
     
    and here is the show raw inputs of that action....
     
    {
    "host": {
    "connectionReferenceName": "shared_sharepointonline",
    "operationId": "CreateFile"
    },
    "parameters": {
    "dataset": "https://my-site/sites/HealthyRecipes-SharePointTesting",
    "folderPath": "/SiteAssets/ListsImages",
    "name": "alex-motoc-v77vc1iAK18-unsplash_Kensley_Lewis_1.jpg",
    "body": "https://my-site/personal/user-company/Documents/Apps/Microsoft%20Forms/Easy%20to%20make%20meals%20for%20a%20Healthy%20Lifestyle%20(Person/Question/alex-motoc-v77vc1iAK18-unsplash_Kensley%20Lewis%201.jpg"
    }
    }
     

    Does that help with what I am doing wrong?

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @kensley 

     

    I genuinely do not see where you get the file content?  Your compose is supplying a link?  You need to physically read the content of the file.

     

    I think you are creating a file with a jpg extension and saving a text string containing the link in the content rather than the encodings of a jpg file.

     

    Have you opened the corrupt jpg in notepad or similar?  This would explain why the browser won't open it as the content of the file is not JPG encoding.

     

    Damien

  • CU09091757-0 Profile Picture
    299 on at

    Yup, I'm 100% with you when you say...

     

    "I think you are creating a file with a jpg extension and saving a text string containing the link in the content rather than the encodings of a jpg file."

     

    How do I get the "actual File Content" from the Microsoft form that submitted the upload file, for this instance? 

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @kensley 

     

    With the url contained within the array you’ve shared, supply it to the action below

     

    DamoBird365_0-1616708461682.png

    You can then use the dynamic content from this action to supply to your file content in the create file action.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here

  • Verified answer
    CU09091757-0 Profile Picture
    299 on at

    Wooo!!!! We got it!!!

    We had to use the OneDrive Connector to "Get File Content" sense the file was already there ;() 

     

    kensley_0-1616710374659.png

    For the *File value, I cycled through my items() to get the id:

     

     

    items('Apply_to_each_to_loop_through_Photo_Cover_array')?['id']

     

     

    Finally tacked this OneDrive connector onto this motha...

    kensley_1-1616710490391.png

    @DamoBird365 thank you so much for helping me out with this!  My images are now previewing correctly in SharePoint because I'm now sending the "actual" file content over. 

     

    You get the trophy, the steaks and fries bro!  

     

    Thanks!

     

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    @kensley no problems... nearly there I hope.

     

    Having just looked at your array again, I think it's actually stored on your one drive, so best use the onedrive get file content using path action with the folder/file path.  Hope this works for you.

     

    DamoBird365_2-1616710653883.png

     

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 289

#2
11manish Profile Picture

11manish 288 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard