cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Re: Renaming a File in SharePoint Online

Hope someone can help since there is clearly something I'm missing. I've followed the steps in the flows but when I do a test the workflow keeps running until it times out. When I look at what's happened I get a Bad Gateway error.

My flow looks like this

Annotation on 2020-03-30 at 12-55-47.png

 

 

 

 

 

 

 

 

 

 

 

 

 

When I combine the site address with the uri, I can view the item's contents without any problems. Have I mistyped or omitted something?


Thanks,
Harry

Highlighted
Regular Visitor

Re: Renaming a File in SharePoint Online

Hi @faustocapellanj ,

I've tried to follow this post about renaming my file in SharePoint. It's been really helpful, but I'm getting the following error message:

 Capture2.PNG

 

Here is why I have:

Capture.PNG

 

When I use your recommended _api/web/lists/GetByTitle('List or Doc Library Name here')

My 'List of Doc Library Name' is 'Documents' and it returns 'SP.Data.Shared_x0020DocumentsItem'

 

I've tried using 'Documents' , 'SharedDocuments' and 'Shared_x0020Documents' instead of 'Shared%20Documents' but still getting the same error message. I wonder if you have an idea on how to get this to work?

Thanks !

Highlighted
Memorable Member
Memorable Member

Re: Renaming a File in SharePoint Online

Hi @izzie21 

I think your issue is that you are using the File Identifier instead of the ID property. If you look at the screenshot below, the section inside the red rectangle is expecting a number not a string.

Untitled.png

Try that and let me know.

Regards

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Highlighted
Regular Visitor

Re: Renaming a File in SharePoint Online

@faustocapellanj any thoughts on why I'm getting an error?

Highlighted
Regular Visitor

Re: Renaming a File in SharePoint Online

Hi @harrymylo ,

 

try this, in the URI field:

  • remove the / in front of _api
Highlighted
Regular Visitor

Re: Renaming a File in SharePoint Online

I have a Folder inside my List. Anyone know how to call that folder instead of the root of the list?

 

I've tried 
_api/web/lists/GetByTitle('Documents/General')

_api/web/lists/GetByTitle('Shared%20Documents/General')

 

And no response from the API. Error I get is 
List 'Documents/General' does not exist at site with URL 'https://

 

@faustocapellanj any thoughts?

Highlighted
Memorable Member
Memorable Member

Re: Renaming a File in SharePoint Online

Hi @BFroc 

I think for your case, you'll have to use the GetFolderByServerRelativeUrl endpoint. The link below has done information about this endpoint. By the way, I'd test the endpoint in the browser first to make sure you can see the folder you need and then try it in Power Automate.

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-resth... 

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Highlighted
Helper I
Helper I

Re: Renaming a File in SharePoint Online

MWAN_0-1592849991479.png

I followed the instructions carefully but the file name is still the original file name, not updated.  

Got an error The parameter __metadata does not exist in method GetById.  double underline before metadata, single quote in the json body

Highlighted
Memorable Member
Memorable Member

Re: Renaming a File in SharePoint Online

Hi @MWAN 

Looking at the screenshot you posted, the Uri parameter is missing something: web. Your Uri value is _api/lists/GetByTitle('Document Request')/Items(ID), but it should be _api/lists/web/GetByTitle('Document Request')/Items(ID). Please update it to match the one I posted and give it a try.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
Highlighted
Helper I
Helper I

Re: Renaming a File in SharePoint Online

Thanks

The flow finished successfully but the name not updated, name should be: EMS_Environment_Matrix-Restricted-WMF-062220-147.xls.

 

MWAN_0-1592856112696.png

 

by the way, I didn't use web in the other URIs to set permission but no issue

_api/lists/getByTitle('Document Request')/Items(insertIDhere)/roleassignments/addroleassignment(principalid=varRequesterID, roledefid=1073741827)

Highlighted
Helper I
Helper I

Re: Renaming a File in SharePoint Online

After I changed the method to Patch, the flow completed successfully because I included an id in the URI, which is not allowed in Post method.

Highlighted
Regular Visitor

Re: Renaming a File in SharePoint Online

Hi @faustocapellanj ,

 

I followed your advice, and was able to get to a point where the HTTP Request identifies the file, no problem, but because I have a nested folder structure, I don't know what to input for SP.Data.LISTNAMEItem in the __metadata call.

 

Using just the very last folder name SP.Data.CHILDFOLDERItem results in this, but any combination of folders doesn't work.

 

BFroc_0-1593730229179.png

BFroc_1-1593730250121.png

 

Any Ideas?

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,743)