Forum Discussion

johnjohn-Peter's avatar
johnjohn-Peter
Iron Contributor
Sep 18, 2025

Create a file using SharePoint rest api will create a corrupted file

I have this formula to send multiple files from power apps to power automate:-

 

ClearCollect(

    i,

    0

);

ForAll(

    AttachFiles.Attachments As d,

  If(AddandRenameFile.Run(

        ClientDropdown.Selected.Value,

        MainCategoryDropdown.Selected.Title,

        SubCategoryComboboxCanvas.Selected.Title & (If(

            Last(i).Value = 0,

            "",

            Last(i).Value

        )),

        MainFolderDropdown.Selected.Value,

        d.Name,

        { name: d.Name, contentBytes: d.Value }

    ).result="Error",Notify("Error uploading file " & d.Name& ". Check if the file name already exsists.",NotificationType.Error),Notify("The File '"& d.Name& "' uploaded and renamed successfully.",NotificationType.Success,10000));

    Collect(

        i,

        Last(i).Value + 1

    )

)

 

here is the flow:-

 

 

 

now the files will be added to sharepoint , but when i tired to open an image i will get this error:-

 

 

 

and when  i try to open a PDF i will get white pages without any content

 

any advice?

 

No RepliesBe the first to reply

Resources