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 / File Rename in SharePo...
Power Automate
Answered

File Rename in SharePoint Help

(2) ShareShare
ReportReport
Posted on by 47
Hi Team, I have created a flow that does the following:
1. When email arrives with a ZIP attachment
2. Create a file in OneDrive
3. Extract Archive (Zip extracts to CSV)
4. Marks email as read
5. Move or Renames CSV
6. Deletes ZIP file
So each time this specific email arrives it overwrites the current CSV in that folder so it is the newest version each time.
Now I am trying to replicate this for my shared mailbox however have found after creating the above that the shared mailbox flow using a shared Teams directory needs to use SharePoint and thus my trouble begins.
I have gotten this far but need help with how to rename the file and delete the ZIP.
1. When email arrives in shared mailbox with a ZIP attachment
2. Create a file in SharePoint
3. Extract Folder (Zip extracts to CSV)
4. Marks email as read
5. Supposedly here I need to use "Send HTTP request to sharepoint" to rename the file however the file that is extracted contains the name of the report and date at the end thus the name is not consistent.
I have tried using ID in the file name in the api/web/getfileby ID, but get badrequest error, same if I try adding get file properties before the send to http.
I am assuming this SHOULD be easy for someone experienced but its driving me crazy :)
Categories:
I have the same question (0)
  • Verified answer
    Expiscornovus Profile Picture
    33,828 Most Valuable Professional on at
     
    You can use a Get file metadata action to find the ItemId value. You can use that value in the URI of your Send an HTTP request to SharePoint action.
     
    Below is an example, if that helps?

    1. Added a Get file metadata with the Id (identifier/path type of value)
     
    2. Use the ItemId in the HTTP request action with a the validateUpdateListItem method
     



     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel
  • jabbajaws77 Profile Picture
    47 on at
    @Expiscornovus
     
    Thanks for your reply, I have taken on board what you have noted below and have had a look at your page link and youtube account but think i might still be making a mistake.
     
    When I run the flow I create the file and its is extracted but one I get to the Send an HTTP request I get a BadRequest error, I must have one of the parameters wrong.
     
    Below is my flow, if you wouldnt mind casting an eye :)
     
  • Verified answer
    Expiscornovus Profile Picture
    33,828 Most Valuable Professional on at
     
    I see you are using the id field. Please make sure you use the ItemId instead in the URI field. That field is returned in the Get file metadata action outputs.
     
    Additionally, the Getbytitle method expects the title/name of the library instead of the the address/url to the library (including the folder part). In your case the name is probably is Documents is instead of /Shared Documents/Reporting bit.
     
    Can you try the below?
     
    _api/web/lists/getbytitle('Documents')/items(@{outputs('Get_file_metadata')?['body/ItemId']})/validateUpdateListItem
     

     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel
  • jabbajaws77 Profile Picture
    47 on at
     
    Bro you are a legend and appreciate the help, if I may be as cheeky to ask 1 last question.
     
    Your updates worked and I was able to create file > Extract File > rename file 
     
    However flow shows as failed due to:
     
    On the apply to each before Get file meta: ActionFailed: An action failed. No dependant actions succeeded.
     
    I think its because the folder contains both the ZIP and the CSV so I moved the delete file (zip) to be above the Apply to Each for the Get Metadata.
     
    However the get meta data even though its running after the delete file still shows the .zip file in the input so assume the error is because it still sees this file.
     
    Thoughts?
     
    At least its running now though, would just like to clean up the failed flows.
     
    Regards
     
    Jamie
     
     
  • Expiscornovus Profile Picture
    33,828 Most Valuable Professional on at
     
    My suggestion would be to unzip/extract the content in a new/different folder and additionally delete the zip as the final action. This way you can make sure everything has completed before you delete the zip.


     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel
  • jabbajaws77 Profile Picture
    47 on at
    @Expiscornovus mate just wanted to say thanks and note how I achieved the result.
     
    I found when I tried to extract ZIP in a different directory the Get Meta was not finding the CSV as it was not in that extract folder directory so I put it back into the same directory and instead added a condition after the apply to each but before the et Meta file and set the condition to look for file name ending in CSV.
     
    Now it runs clean using your first 2 posts and that condition.
     
    Really appreciated you taking the time to help, this stuff is a but confusing and its trial and error but you made it happen so thanks.
     
    PS. Ill be back :)
     
    Jamie

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 557

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 264 Super User 2026 Season 1

Last 30 days Overall leaderboard