Hi,
I'm trying to do something fairly simple but can't get to the bottom of it. I have 400+ sharepoint sites created for clients each site is attached to a team and each project for that client is a channel under that team.
All our projects have a status for Complete or Archive. and i now need to apply that metadata to the channel folders created this will be set by referencing a SharePoint list that contains all our projects and what status they are at. Because i won't know the full path details of the file I can't use the update metadata properties connector, as it doesn't pull through the custom site column as it obviously doesn't know it exists at that point.
I know I can do this via a HTTP request but i can't seem to get anything working. I've followed a few guides but I keep getting errors. I follow most of the info from this - https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest
But i'm getting bad gateway errors or just general not valid errors. i'm trying to use a get request to get the Odata.type and then the post request to update the field ProjectStatus. I've attached some images showing http calls.
Any help would be great i've been stuck on this for a couple of days now and i feel it should be something simple. if it a files metadata it's easy but folders seem to be something else.
Solved! Go to Solution.
Hello @mousman85 ,
You can use "Get folder metadata using path" action to get the folder item ID, and then use Update Item or Send HTTP Request with Rest API to update item in folder to update folder properties, please see below screenshot
Get Folder Metadata from Path
Set Folder Properties using ItemId from Get Folder Metadata
Hi,
thanks for the reply, I'm still getting an error on this. I've tried setting the ID using the ID dynamic data field and itemID dynamic field from the get folder metadata connector, but it returns the same error please see attached image, not sure what the issue is? The error image is showing a missing ) at the end of the ID but this is there in there in the Uri. Would I be better of composing the URI and using an output from a compose? i need the request to cycle through a load of sites and folders could end up being 100's
Hello @mousman85 ,
You can use "Get folder metadata using path" action to get the folder item ID, and then use Update Item or Send HTTP Request with Rest API to update item in folder to update folder properties, please see below screenshot
Get Folder Metadata from Path
Set Folder Properties using ItemId from Get Folder Metadata
Hi,
thanks for the reply, I'm still getting an error on this. I've tried setting the ID using the ID dynamic data field and itemID dynamic field from the get folder metadata connector, but it returns the same error please see attached image, not sure what the issue is? The error image is showing a missing ) at the end of the ID but this is there in there in the Uri. Would I be better of composing the URI and using an output from a compose? i need the request to cycle through a load of sites and folders could end up being 100's
there is an issue in the URI value in your HTTP action, it should be as follows
_api/web/lists/getByTitle('Documents')/items(<ID>)
where as you have as follows which is incorrect
_api/web/lists/getByTitle('Documents')/items/(<ID>)
thanks I didn't even notice that.
So it seems to be picking up the Uri correctly but I'm getting an error that the parameter __metadata doesn't exist, I was getting this error before, ended up down a rabbit hole and wasn't really sure what the fix would. Thanks for your help so far.
Can you please post the content of body of the action here, I just want to see if there are any unnoticeable syntax error.
Below is the body for the call.
{
"__metadata":{
"type": "SP.Data.Shared_x0020_DocumentsItem"
},
"ProjectStatus":"archive"
}
and this is the output body for the error:
"status": 400,
"message": "The expression \"web/lists/getByTitle('Documents')/items(%2fShared+Documents%2fGeneral)\" is not valid.\r\nclientRequestId: 03c6e99e-ff51-4a2a-96e6-359c494b1245\r\nserviceRequestId: 5699979f-e0b5-2000-9268-0e8abdebc6d7",
"source": "https://drsite.sharepoint.com/sites/DemoClientEnvironment/_api/web/lists/getByTitle('Documents')/items(%252fShared%2bDocuments%252fGeneral)",
"errors": [
"-1",
"Microsoft.SharePoint.Client.InvalidClientQueryException"
]
}
So i had to add additional header fields for this to work:
accept = application/json;odata=verbose
content-type = application/json;odata=verbose
X-HTTP-Method = MERGE
IF-MATCH = *
yes those headers needed to be provided in the action, i already had in the screenshot i posted in my response here. I understand now the Http call with working for you?
Thanks, I didn't spot those headers when I was looking at the images apologies, but yes this is all working as intended now thank you for your help.
Hello,
I can not seem to get the above solution to work for a site (Teams site) with a subfolder Example - /Documents/TeamName/Subfolder
I am creating new Channels in a Team and then creating subfolders for which I need to update a column of data "FiscalYearEnd" on each folder. I can not get the dynamic content of "Folder Path" because the function is in a loop.
I have tried multiple variations of the folder path. I even took out the "Get Folder metadata using path" function and tried to use dynamic content in the Send an HTTP function, but nothing seems to find the subfolder successfully.
Here are the steps (in an apply to each loop)
@Jaison11 can you please share more details on what is not working for you? Is your folder getting created? and Send Http is not working, if yes what error are you getting?
Hello @annajhaveri ,
I posted this question to the forum and ended up figuring out the problem and marking the post solved. I apologize for the confusion. I do, however, have a new post on the forum that I just posted a few moments ago. Not sure if you can offer any advice on it?
Dynamically Get Value of an Excel Column from a Dy... - Power Platform Community (microsoft.com)
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Learn from the top Power BI, Power Apps, Power Automate & Power Virtual Agents experts!
User | Count |
---|---|
32 | |
32 | |
22 | |
22 | |
19 |
User | Count |
---|---|
56 | |
55 | |
41 | |
37 | |
29 |