cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thegreenjudy
Frequent Visitor

Automating the description column in a Sharepoint Document Library

Hi all,

 

I am trying to use Power Apps for the first time. We have a Sharepoint Document Library which will be containing customer folders with sub-folders which are consistently named with the same title every time (these are already automatically generated through another system). I want these sub-folders to all have the same description in the description column to use as a guidance for saving documents.

 

For example:

 

NameModifiedDescription
Folder AJanuary 24Statement of Works, Purchase Order
Folder BJanuary 24Delivery Documents, PID

 

I have created this manually for a test folder and now want to automate the description field whenever these folder names are created. 

 

Is this possible? I've been playing around with power apps and googling but can't make much sense of the tool.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
wskinnermctc
Solution Sage
Solution Sage

First, I just want to be sure you plan on using "Power Automate" and not "Power Apps" since Power Automate is a tool that works on triggers to run automatic flows.

 

Seems like you will have to figure some things out, but your flow is not complicated and can be done by Power Automate.

The most difficult part for you will be making conditions on when or how to add different descriptions to folders by name. Like If folder is named "Projects" then the description should be 'These are project documents' and if the folder is named "Contracts" then the description should be 'These are contract documents'.

 

You need to create a Power Automate flow that triggers using SharePoint - When a file is created (properties only)

After the trigger you will use the values of the trigger output such as Name or IsFolder to make conditions on what you want to happen next.

Then you need to use the step SharePoint - Update file Properties and put what you want in the Description field.

 

Below is just a short example, but you might need to add other steps to deal with conditions of names or file types. This flow will trigger every time a file or folder is created in the document library. So you want to make sure that it is only acting on the items that you want to change. So that means putting in conditions that don't update descriptions of Word Documents/Excel/Pictures or anything else that is added to the document library.

 

Update File Properties.png

Hope this helps get you started

 

View solution in original post

10 REPLIES 10
wskinnermctc
Solution Sage
Solution Sage

First, I just want to be sure you plan on using "Power Automate" and not "Power Apps" since Power Automate is a tool that works on triggers to run automatic flows.

 

Seems like you will have to figure some things out, but your flow is not complicated and can be done by Power Automate.

The most difficult part for you will be making conditions on when or how to add different descriptions to folders by name. Like If folder is named "Projects" then the description should be 'These are project documents' and if the folder is named "Contracts" then the description should be 'These are contract documents'.

 

You need to create a Power Automate flow that triggers using SharePoint - When a file is created (properties only)

After the trigger you will use the values of the trigger output such as Name or IsFolder to make conditions on what you want to happen next.

Then you need to use the step SharePoint - Update file Properties and put what you want in the Description field.

 

Below is just a short example, but you might need to add other steps to deal with conditions of names or file types. This flow will trigger every time a file or folder is created in the document library. So you want to make sure that it is only acting on the items that you want to change. So that means putting in conditions that don't update descriptions of Word Documents/Excel/Pictures or anything else that is added to the document library.

 

Update File Properties.png

Hope this helps get you started

 

Chriddle
Solution Sage
Solution Sage

Hey,  that works, despite the trigger "When a file is created". You never stop learning 😉

 

Anyhow, the TS said that these folders already exist.

Therefore he needs a different trigger and the "List folder" action.

Since this action doesn't list nested folders, I assume he has to do recursion.

Or is there a better way?

Maybe if the structure is as predictable as the TS said.

 

I wouldn't use conditions to separate the folder names as you would need multiple of them to capture all the folder names.

Instead I woul add a compose action with an object like this:

Chriddle_0-1675270478801.png

and use this expression as the description (replace 'Folder A' with the folder name from the trigger and 'no description' with whatever description you want for folder names not in the object, e.g. the original description):

 

 

 

coalesce(outputs('Description')?['Folder A'], 'no description')

 

 

 

 

Thank you for your response and yes, I apologise - I was thinking Power Automate but typing Power Apps. 

It is indeed Power Automate I intend to use.

 

I started with the "When an item is created" option - Does "When a file is created" work with folders as well?

 

*Just noticed the next post, I think the "file" is a red herring..whoops

Good point, I actually ran into a snag here to determine the folder ID

 

Just to clarify, the folders don't exist yet. They get created when a certain custom action is performed in another system via SharePoint Integration. The only folders that already exist are the country folders and the Projects Folder.

 

To visualise this:

 

Country > Projects > Customer Name > Project Name > 4 sub folders (pre-project, initiation, delivery, closure)

 

The folders in bold only get generated when the Sharepoint integration is triggered from the project itself in the PM System. Sometimes the customer already exists so the new Project Name folder might be added to an existing customer.

The folders in red I want to apply the conditions to. So essentially, I don't have a folder ID to add because that folder doesn't exist yet (sorry to throw a spanner in the works)

thegreenjudy_0-1675277118875.png

This is what I did but I am not sure why it didn't work. I only tried it with one trigger to test. It says it ran successfully but nothing happened - maybe it's because the "Guidance" column is a text column? It gave me a bit of grieve when I first set it up and trying to add text manually, saying it's locked?

thegreenjudy
Frequent Visitor

Sorry for the flurry of posts, I now changed the Id to ID instead of the name of the column and it worked,  but only in the top folder. It seems like the rule does not apply this rule to all folder created in the library (including sub-folders)

thegreenjudy
Frequent Visitor

aaaaah it;s working now!! Thaaaank you!

wskinnermctc
Solution Sage
Solution Sage

It looks like you got it working. I was making an example showing how the trigger and dynamic fields work.

 

First I created a flow with the trigger when a File is Created (Properties Only) and then added some compose statements to see results.

I saved the flow and created a SharePoint Folder named "New Folder 01Feb2023"

Then you can see the results of the flow.

 

Flow TriggerFlow Trigger

Next Made a Folder:

SharePoint FolderSharePoint Folder

Then check results in Flow:

ResultsResults

 

However, I did drag a new MS Word Document into the Folder right after I created the folder. And you can see the flow was triggered twice. Once when the folder was created and then again when the MS Word document was added. So the trigger doesn't care if it is a Folder or File for it to initiate.

Flow RunsFlow Runs

There is another method that is similar to a Condition but it is called a Switch. This checks a value similar to a condition but you can have multiple paths. So you could put in a Switch control that uses the file/Folder name, and then each case would be one of the possible outputs that you are looking for. 

 

I made an example below with the Switch and you can see the results in my sharepoint document library.

Control with SwitchControl with Switch

 

The results show the folders were updated after I created them.

Folder DescriptionsFolder Descriptions

 

This method might be easier since everything is visible up front.

 

Let me know if this works for you,

thegreenjudy
Frequent Visitor

Ahh that's brilliant - the second method seems to just approach this from a slightly different angle, which makes sense. Thank you! This has saved my day 🙂

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,472)