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
Unanswered

How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

(0) ShareShare
ReportReport
Posted on by 120

My code takes a template and copies it to another folder. It will then send an http request to a onenote file and an excel file to rename them. I can not figure out how to change the metadata part of the body so it actually changes this does anyone know how to fix this?

zajacjos_1-1690391979730.png

zajacjos_2-1690393580961.png

 

zajacjos_0-1690391884172.png

 

{
"__metadata":{
"type": "@{body('Send_an_HTTP_request_to_SharePoint')['d']['__metadata']['type']}"
},
"Title": "@{variables('Folder Name')}",
"FileLeafRef": "@{variables('Folder Name')}"
}

I have the same question (0)
  • Expiscornovus Profile Picture
    32,856 Most Valuable Professional on at
    Re: How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

    Hi @zajacjos,

     

    That first HTTP POST request will not return the type with those headers. As far as I am aware it will only return a HTTP 204.


    What you could do is add a HTTP GET request to retrieve the type instead directly after the Copy Folder action. You can use the outputs of that action instead of the current type expression you are using.

     

    Try something like below:

     

    selecttype.png

     

    After that you should be able to use:

     

    outputs('Send_an_HTTP_request_to_SharePoint_-_Type')?['body']['d']['__metadata']['type']

     

     

    If it helps I got also two code snippet example blogs about this use case:

    https://www.expiscornovus.com/2022/11/15/get-odata-type-folder/

    https://www.expiscornovus.com/2022/11/15/rename-a-folder/

     

  • zajacjos Profile Picture
    120 on at
    Re: How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

    zajacjos_0-1690566298120.png

    I tried this and it didnt work should I be doign the outputs in the bodies of the rename?

  • Expiscornovus Profile Picture
    32,856 Most Valuable Professional on at
    Re: How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

    Hi @zajacjos,

     

    My suggestion was to use that expression in the body of the rename action.

     

    Below is the full example

     

    {
    "__metadata":{
    "type": "@{outputs('Send_an_HTTP_request_to_SharePoint_-_Type')?['body']['d']['__metadata']['type']}"
    },
    "Title": "@{variables('Folder Name')}",
    "FileLeafRef": "@{variables('Folder Name')}"
    }

     

    metadata_value.png

  • zajacjos Profile Picture
    120 on at
    Re: How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

    zajacjos_0-1693318593542.png

    zajacjos_1-1693318646669.png

     

    zajacjos_2-1693318668886.png

    zajacjos_3-1693318713332.png

     

    Any clue why This isnt working?

  • Expiscornovus Profile Picture
    32,856 Most Valuable Professional on at
    Re: How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

    Hi @zajacjos,

     

    Looks like a typo. You used a different name for that request Type action.

     

    I used "Send an HTTP request to SharePoint - Type". You used "Send an HTTP request to - Type".

     

    The expression cannot find the action name you used in the expression.

     

    You have two options to fix this.

     

    1. Change the name of the action in the expression to what you used as an action name.

     

    {
    "__metadata":{
    "type": "@{outputs('Send_an_HTTP_request_to_-_Type')?['body']['d']['__metadata']['type']}"
    },
    "Title": "@{variables('Folder Name')}",
    "FileLeafRef": "@{variables('Folder Name')}"
    }

     

    2. Or alternatively rename the action to what I used in my example (in other words, add the missing word SharePoint), in that case you don't have to update the expression in the body. 

  • zajacjos Profile Picture
    120 on at
    Re: How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

    Very odd now it is just copying the name of the template. 

    zajacjos_0-1693322084455.pngzajacjos_1-1693322109610.png

    zajacjos_2-1693322154850.pngzajacjos_3-1693322161966.png

     

     

  • Expiscornovus Profile Picture
    32,856 Most Valuable Professional on at
    Re: How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

    Hi @zajacjos,

     

    Did you include the name of the document library in the Uri of the last HTTP request? In your last screenshots it looks like that part is missing.

     

    libraryname_included_check.png

  • zajacjos Profile Picture
    120 on at
    Re: How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

    zajacjos_0-1693326763621.png

    zajacjos_1-1693327003796.png

    I changed to Project Folders

    It is now accepting it. Still no change on the one note file though.

    zajacjos_2-1693327058061.png

     

     

  • Expiscornovus Profile Picture
    32,856 Most Valuable Professional on at
    Re: How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

    Hi @zajacjos,

     

    I see you removed the /sites/automation part, that is also required.

     

    In both actions can you make sure the URIs are like below:

     

    Action to retrieve the type value

    _api/web/GetFolderByServerRelativeUrl('/sites/automation/Project Folders/@{outputs('Copy_folder')?['body/Name']}')/ListItemAllFields?$select=type

     

    Action to rename Folder

    _api/web/GetFolderByServerRelativeUrl('/sites/automation/Project Folders/@{outputs('Copy_folder')?['body/Name']}')/ListItemAllFields

     

  • zajacjos Profile Picture
    120 on at
    Re: How to fix my HTTP REQUEST TO SHAREPOINT body so it doesnt time out

    zajacjos_0-1693401780233.png

    zajacjos_1-1693401821923.png

    zajacjos_2-1693401864420.png

     

    Im really confused why it isnt changed the onenote. Am I making changes a layer too high? I thought fileleafref is what I need to change the name of a onenote file?

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 691 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 431 Moderator

#3
developerAJ Profile Picture

developerAJ 266

Last 30 days Overall leaderboard