cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jkeckard007 Helper III
Helper III

Re: Renaming a File in SharePoint Online

The HTTP header Content-Type is missing or its value is invalid. clientRequestId: 7f1cbf8f-0cd2-4e0f-8cb1-d80eecfbda35 serviceRequestId: 32bcc59e-d05e-8000-0802-9c5261c0dc6b
Super User
Super User

Re: Renaming a File in SharePoint Online

Hi @jkeckard007 

This is your screenshot below. I highlighted what seems to be wrong in your Update File Name step. Please correct those and try again. Let us know if it worked.

Http.JPG

Regards,

Fausto Capellan, Jr

 


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


jkeckard007 Helper III
Helper III

Re: Renaming a File in SharePoint Online

Sam error. I do know the list name has been changed so I am not sure if that matters the actual url SPECIFICATION%20UPDATES/Forms/Active.aspx

 Below is the output  I am trying to rename the file name...not the folder name...is that an issue?

Error1JPG.JPGerror2.JPG

Super User
Super User

Re: Renaming a File in SharePoint Online

Hi @jkeckard007 

First, try to navigate to the URL in your screenshot, which should look like: http://yourdomain.sharepoint.com/sites/yoursitehere/_api/web/lists/getbytitle('Spec Bulletins Pending Library')/items(400). This is to make sure items are being retrieved. If that works, then update the Body of your Update File Name step as indicated in the screenshot below:

{'__medatada':{'type':'SpecBulletinsPendingLibrary'}, 'FileLeafRef':'SB-038-Title MSFlow'}

error2.JPG

 


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


jkeckard007 Helper III
Helper III

Re: Renaming a File in SharePoint Online

Sorry for the back and forth. I do get the rest call back I checked that but still having issues

error3JPG.JPG

mnoorgat
Regular Visitor

Re: Renaming a File in SharePoint Online

Hi all,

 

I finally figured this out but took me a little more investigating.  The issue for me was in regards to the Body and the Sp.Data line.  It kept on giving me an error "A type named 'SP.Data.BItem' could not be resolved by the model. "  This was because BItem was not the name of my document library, however even using the document library name 'SP.Data.Published%20BackupsItem' this still failed.  Until I discovered the way to find the actual SP.Data name.

 

I plugged this into my browser:

https://yourdomain.sharepoint.com/sites/yoursitehere_api/web/lists/GetByTitle('Published%20Backups')?$select=ListItemEntityTypeFullName

 

Looking near the end of the resulting output located for me the correct SP.Data value I had to add:

<d:ListItemEntityTypeFullName>SP.Data.Published_x0020_BackupsItem</d:ListItemEntityTypeFullName>

In case it wasn't clear it was SP.Data.Published_x0020_BackupsItem for me

 

So I amended the body as below and it worked a treat: 

{'__metadata':{'type':'SP.Data.Published_x0020_BackupsItem'},'FileLeafRef':' @{outputs('Compose')}'}

Regards,

 

Mohamed Imran

EricChan
Regular Visitor

Re: Renaming a File in SharePoint Online

I find this thread today, learn from you guys and find a workaround to my problem of adding prefix to all file names in a folder. Thank you very much, especailly @faustocapellanj .

 

@jkeckard007 , one remaining mistake I catch: instead of the boy's name, try "application/json; odata=verbose". Smiley Happy Hope it helps.

 

For my problem, my original approach is to get hold of the folder, list out the files within the folder, and the update the file names one by one:

  1. Get folder metadata using path
  2. List folder
  3. Apply to each | Send HTTP request to SharePoint

However, I can't get hold of Item ID of the respective files but just the File ID (as shown as Id) this way.

 

Rename Files.JPGFlow excerpt to add prefix to files in folder

 

Excuse me for digressing but any insight on the relationship between File ID and Item ID? 

jonatanmunoz
Regular Visitor

Re: Renaming a File in SharePoint Online

Hi All,

 

Thanks for all your advices.

 

Unfortunately I still have some error when I run the flow:

 

My list is: temp_ml

Error: BadRequest 

"message": "A type named 'SP.Data.temp_mlItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.\r\nclientRequestId: 7a1fe443-b653-44d3-b6bc-98cb48a48f57\r\nserviceRequestId: 481ee69e-207a-8000-586e-8cdc1d504b62",
 

Body:

{'_metadata':
{'type':'SP.Data.temp_mlItem'},'FileLeafRef':'Nombre'
}

 

What could be the issue? 

 

Thanks!

Super User
Super User

Re: Renaming a File in SharePoint Online

Hi @jonatanmunoz 

 

Can you please post a screenshot of your Flow action, especially the HTTP action?

 

Thanks,

Fausto Capellan, Jr


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Sorenaa
Frequent Visitor

Re: Renaming a File in SharePoint Online



Hi @faustocapellanj , 

 

Thanks for great guidance on this post. I have a question, how can I navigate to an item with other properties, and not ID. I mean in _api/web/lists/GetByTitle('ListName')/items(ID), is there a way that I put for example file name instead if ID. Please advise.

 

Thanks

Super User
Super User

Re: Renaming a File in SharePoint Online

Hi @Sorenaa 

What are you trying to achieve exactly so I can point you on the right direction?


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Sorenaa
Frequent Visitor

Re: Renaming a File in SharePoint Online

Hi @faustocapellanj 

That was quick! Thanks. I am trying to do the rename a file, which I copied within a folder in previous step in my flow, so I don't have the item ID, I want to know if I can navigate to item by something else, e.g. item's Name. Am I clear enough?

 

Thanks,

 

Super User
Super User

Re: Renaming a File in SharePoint Online

@Sorenaa 

Can you please post a screenshot of your Flow?

Thanks.


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Sorenaa
Frequent Visitor

Re: Renaming a File in SharePoint Online

@faustocapellanj 

Capture.PNG

I am not sure what to put in .../items (??) to access the file by name. My goal is after copy folder is done, rename a file that exist in the folder just copied over.

 

Thanks

Super User
Super User

Re: Renaming a File in SharePoint Online

Hi @Sorenaa 

Not sure if the Copy SharePoint Folder from Library will give you the file ID since it's just copying a folder. How many files do you have in the folder being copied?


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Sorenaa
Frequent Visitor

Re: Renaming a File in SharePoint Online

@faustocapellanj 

Yes, that's why I am asking if I can anything else other than ID. There are couple of files and folders. 

 

Thanks,

felipewltc Helper II
Helper II

Re: Renaming a File in SharePoint Online

Hello, I have a question, Iimage.png

have the flow like this. 

What I need to do is to be able to add a new file to the SharePoint list and if I am using the same name from other files, the flow changes the name of the file or just add something to have both, can you help me with it?

jonatanmunoz
Regular Visitor

Re: Renaming a File in SharePoint Online

Hi @felipewltc 

 

Mi first idea is:

 

1. Create a String Variable with a known content (for example _empty). I will call VarName

2. Get files (properties only) with filter Name eq 'VarName'. 

3. Set Variable with the propertie Filename (from Get Files). (Dont worry about Each One iteration, because you only will have one element).

4. IF Control with the condition: IF VarName not equal to '_empty'.

If yes, rename the file. If no, do nothing.

 

If the Flow will execute again in the same Run, then dont forget to set again VarName to _empty after rename the file.

 

 

felipewltc Helper II
Helper II

Re: Renaming a File in SharePoint Online

@jonatanmunoz  I am very new with all this, do you have a way to contact you? more than here, like skype or email or something? 

Anonymous
Not applicable

Re: Renaming a File in SharePoint Online

Hi @v-bacao-msft,

 

I tried this but Im getting the error:

List 'Rechnungseingang' does not exist at site with URL.

 

Emichan_0-1572428113817.png

 

I don't know what I'm doing wrong, because I just started with Workflow. What I want to do is, when a user fills values into certain columns, that the filename is automatically renamed with these values. 

 

Best Regards,

 

Emi

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (6,069)