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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

HTTP Rename File Flow Not Working

(0) ShareShare
ReportReport
Posted on by 47

Summary:  I have created a flow to rename PDF files I have saved to a sharepoint site.  The flow creates an array from an excel file I have saved on OneDrive which contains the original file name and the name I would like to update each file to.  It is supposed to iterate through each file listed in the excel file but I keep getting bad request 400 errors at the HTTP stage.  

 

I really tried to research and solve this problem on my own (see bottom of post for list of a few resources I checked) but at this point I feel totally lost and everything is a blur.  I am still very new to Power Automate... Any suggestions as to what I have done wrong?  I confirmed I have user permission to the sharepoint site.  Sorry if the following is information overkill but I figured more is preferrable in this situation.

 

My flow: 

flow_screenshot.png

 

HTTP Settings:

http_screenshot.png

 

What I have tried: 

Http Input Looks as Follows:
{
    "host": {
        "connectionReferenceName": "shared_sharepointonline",
        "operationId": "HttpRequest"
    },
    "parameters": {
        "dataset": "Name Removed - https://REMOVED.sharepoint.com/sites/XYZ",
        "parameters/method": "POST",
        "parameters/uri": "_api/web/lists/GetByTitle('XYZ')/items('test.pdf')",
        "parameters/headers": {
            "content-type": "application/json;odata=verbose",
            "IF-MATCH": "*",
            "X-HTTP-Method": "MERGE"
        },
        "parameters/body": "{'__metadata': {'type': 'SP.Data.BItem'}, 'FileLeafRef': 'newtestname.pdf - {\"@odata.etag\":\"\",\"ItemInternalId\":\"ebe10853-7888-4d1f-af73-3ba7f9784de9\",\"Source_File\":\"test.pdf\",\"Name_To\":\"newtest.pdf\"}'}"
    }
}
 
HTTP Output:

Output:

{

    "statusCode": 400,

       "body": {

        "status": 400,

        "message": "SharePoint Site Address 'XYZ - https://REMOVED.sharepoint.com/sites/XYZ/Test_Logging' is not valid\r\nclientRequestId: 2e371fae-c88b-42e6-9476-fe5deb52c390",

        "error": {

            "message": "SharePoint Site Address 'XYZ - https://REMOVED.sharepoint.com/sites/XYZ/Test_Logging' is not valid"

        },

        "source": "sharepointonline-ce.azconn-ce-001.p.azurewebsites.net"

    }

}

 

Troubleshooting Sources I have read: 

I have the same question (0)
  • Verified answer
    Expiscornovus Profile Picture
    32,912 Most Valuable Professional on at
    Re: HTTP Rename File Flow Not Working

    Hi @gorgodzilla,

     

    Based on the error message you have shared it looks like you have included the site name in the Site Address field as well, in other words 'XYZhttps://REMOVED.sharepoint.com/sites/XYZ/Test_Logging'

     

    Can you try the below in the site address:

    https://REMOVED.sharepoint.com/sites/XYZ

     

    The Site Address (aka dataset) only expects an url of the site (without the name of the site and without anything else like for example a list name, library name or page part).

     

    Below is a screenshot to demonstrate this with a site address I selected from the dropdown. As you can see it only uses the URL of the site.

     

    dataset_parameter.png

     

    The second thing I would suggest to double check is the type value within your __metadata of your Body payload.

     

    You are using SP.Data.BItem, however the name of the list is XYZ. Normally that type would be different based on the name of the list, in that case the would be SP.Data.XYZItem. So you might be using the wrong value, can you double check this? 

     

    That value should be the ListItemEntityTypeFullName property of a list.

    {'__metadata': {'type': 'SP.Data.XYZItem'}, 'FileLeafRef': 'newtestname.pdf - {\"@odata.etag\":\"\",\"ItemInternalId\":\"ebe10853-7888-4d1f-af73-3ba7f9784de9\",\"Source_File\":\"test.pdf\",\"Name_To\":\"newtest.pdf\"}'}"
     }

     

     

     

  • gorgodzilla Profile Picture
    47 on at
    Re: HTTP Rename File Flow Not Working

    Hello,

     

    I tried updating the URL as suggested above (removed the name).  Unfortunately when I ran my tests the error switched to a 404 error.  The URL I used previously was selected from the drop down menu, but when I used the URL above I had to enter it as a custom value.  When I switch back to the drop down URL it goes back to a 400 error.

     

    I verified that when I manually enter the URL mentioned above into my browser I am taken to the correct page so there are no typos or anything.

     

    Any other ideas?   

     

    Thank you for pointing out the metadata issue - I have corrected this and changed it to SP.Data.XYZItem.

     

  • gorgodzilla Profile Picture
    47 on at
    Re: HTTP Rename File Flow Not Working

    I went back and re-confirmed that my input URL looked like the one Expiscornovus mentioned above (see at the bottom of this reply).

     

    I also went back and performed a test to confirm that I have permission to access sharepoint (assuming perhaps it was a permission issue).  When I selected "List folder" I was able to select the site address from the dropdown and then the subfolder "/Test_Logging" as a File Identifier.  I was able to email myself the output (Id, Name, etc) from this step so I do not think it is a permissions issue... 

     

    "host": {

            "connectionReferenceName": "shared_sharepointonline",

            "operationId": "HttpRequest"

        },

        "parameters": {

            "dataset": "https://REMOVED.sharepoint.com/sites/XYZ",

            "parameters/method": "POST",

            "parameters/uri": "_api/web/lists/GetByTitle('Test_Logging')/items('test.pdf')",

  • Expiscornovus Profile Picture
    32,912 Most Valuable Professional on at
    Re: HTTP Rename File Flow Not Working

    Hi @gorgodzilla,

     

    I see you are using /items('test.pdf') to retrieve your test.pdf file. Normally that items expects the id value of the item, which is an int/number. In other words that part would be /items(25) if the id of test pdf is 25. Do you know the Ids of your files?

  • gorgodzilla Profile Picture
    47 on at
    Re: HTTP Rename File Flow Not Working

    I was able to retrieve the item ID (33, 34, etc.)  It seems like I am getting closer but I am now getting the following error:  A type named 'SP.Data.Test_LoggingItem' could not be resolved by the model.

     

    Some of the resources I have read said that SP.Data.()Item is reserved for lists.  A few other resources have said I need to find the "Internal Name" of the Document Library but I cannot find that anywhere.  A few tutorials said if I tried to rename my columns I would see the internal name in the URL, but all I see is the column name.  

     

    All of the tutorials I was building my model off of use the Sp.Data.()Item to rename files stored in a document library... 

  • Expiscornovus Profile Picture
    32,912 Most Valuable Professional on at
    Re: HTTP Rename File Flow Not Working

    Hi @gorgodzilla,

     

    Like mentioned earlier and in the blog I shared special characters in the type property are normally encoded:

    https://www.expiscornovus.com/2021/07/10/listitementitytypefullname-within-power-automate/

     

    Have you double checked what the ListItemEntityTypeFullName property value is your Test_Logging list?

     

    Based on the name of the list I would have expected it to be (because it contains an underscore character)

    SP.Data.Test_x005F_LoggingItem

     

  • gorgodzilla Profile Picture
    47 on at
    Re: HTTP Rename File Flow Not Working

    Updating to Test_x005f_LoggingItem seems to have resolved the SP.Data error.  It seems like it's getting really close here... I didn't error out this time, but the http request seemed to get caught in a perpetual loop... I let the test run for 20 minutes and it still didn't complete.  It wouldn't give me an error message or any output. 

     

    I tried to trouble shoot by making a copy of the https request and hardcoding all of the inputs (ID, metadata, and file name) to see if I could at least rename one file but it gives me the following error:

     

    The request ETag value '' does not match the object's ETag value '"d728f2d1-5ab2-4c18-a916-8257abf493d9,2"'.

     

    updatedhttps.png

    (I tried /items(33) and /items('33') but both returned the same error).

     

    I am currently investigating possible solutions and will report back and update this thread if I am able to resolve it so that this post can be marked as Solved.  

  • Expiscornovus Profile Picture
    32,912 Most Valuable Professional on at
    Re: HTTP Rename File Flow Not Working

    Hi @gorgodzilla,

     

    I see a small typo in your header. Can you change If_match to If-Match?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard