cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
efialtes
Level 8

Workaround to update SharePoint document metadata custom columns

Hi all

Microsoft Flow team has already planned this feature (please see https://powerusers.microsoft.com/t5/Flow-Ideas/Update-SharePoint-document-metadata/idc-p/44422#M2713 ). In the meanwhile, I followed @JRitmeijer recommendations at https://powerusers.microsoft.com/t5/Flow-Ideas/SharePoint-File-triggers-need-to-return-numerical-ID/... to implement a temporary workaround to update custom columns:

 

The workaround if based on the fact you can create Flows from a SP Library, as explained here:

https://support.office.com/en-us/article/Create-a-flow-for-a-list-or-library-in-SharePoint-Online-a9...

 

So first, I select a library's document, then tap on "Create a Flow", and select the template "Request manager approval for the selected file". Such flow includes:

-a request Trigger providing "FileName" and ID as outputs.

-a SP "Get Item" bringing as default input the SP List Name, and "Folder path" as one of the outputs.

 

After these two steps I add SP "Get File Metadata using path" in order to get the File Content.

 

Finally, after completing all the calculation needed, I add a SP "Update item" action block. I get the SP List Name from the input default values  included in the original template "Get Item". Once I add them, the metadata columns are displayed as inputs in the new action block.

 

Hope this helps!

 

Flow_workaround_metadata.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
efialtes
Level 8

Re: Workaround to update SharePoint document metadata

Oops! It seems @merwan already described this workaround some days ago

https://powerusers.microsoft.com/t5/Building-Flows/File-approval-process-in-SharePoint/m-p/4174#M224...

Sorry for the duplication Smiley Sad

8 REPLIES 8
Phil_Worrell
Level: Powered On

Re: Workaround to update SharePoint document metadata

Thanks so much for that.
efialtes
Level 8

Re: Workaround to update SharePoint document metadata

Oops! It seems @merwan already described this workaround some days ago

https://powerusers.microsoft.com/t5/Building-Flows/File-approval-process-in-SharePoint/m-p/4174#M224...

Sorry for the duplication Smiley Sad

KREI_CZ
Level: Powered On

Re: Workaround to update SharePoint document metadata custom columns

I am trying to replicate this thing for document library but without any success...

Does it works only for a lists?

efialtes
Level 8

Re: Workaround to update SharePoint document metadata custom columns

@KREI_CZ The screenshots I posted are from a Document Library related Flow. In which step you are struggling to replicate this workaround?

KREI_CZ
Level: Powered On

Re: Workaround to update SharePoint document metadata custom columns

Thank you very much for your time, let me show you the full story Smiley Happy

 

I need to get email attachment, together with email address and for example body(simply any custom parameter), to a SharePoint library.

 

So I have created library like this:

2017-07-13 18_25_50-folder test - Email importer - All Documents.png

 

I am able to get attachmets, but I am not able to use custom metadata to store the rest of the informations...

Ideally this should be stored in list item as an attachments but I have found it absolutly impossible to use list attachments...

 

So what I have did:

1) New email recieved - save attachmets to library

2) Get a metadata of this new file

3) Update/Save rest of the informations about the email to file metadate

 
See screenshots below(sorry for czech language, I have switched language but some parts are still in czech...):

2017-07-14 09_26_31-Manage your flows _ Microsoft Flow2.png2017-07-14 09_27_32-Manage your flows _ Microsoft Flow3.png2017-07-14 09_25_04-Manage your flows _ Microsoft Flow.png

 

So I am getting metadata from file I have stored from email importer, but not a custom ones as you can see.

And then in update file step, I have only file content field to be updated...

 

So I thought that you are updating list item, thats why you cant see more than me on your last screenshot, am I correct?

 

Its a little bit different scenario but I have tried to apply similiar logic as you.

Highlighted
efialtes
Level 8

Re: Workaround to update SharePoint document metadata custom columns

@KREI_CZ

Please note the workaround I originally described is only valid when you create the Flow from the Sharepoint Document Library and invoke it manually from there. In such circumstances, the trigger includes both the List Name, the Item ID and the FileName. So, we get item related info, and also file related info.

 

The scenario you describe seems different, since the execution trigger differs. Then you work with Create File, so you do not get any clue of either List Name or Item ID. As far as I know, you currently cannot manipulate Document Library custom metadata unless you get List related info.

 

Let's hope Microsoft Flow team will fix such limitations, in the meanwhile and since it looks like you need to have the whole process executed automatically without manual intervention, I would suggest you a different approach:

 

1. Obtain the List Name by creating a Flow as I did from the Document Library. Copy it, you can then discard this Flow.

2. Get back to you original Flow, after Create File add a SP Get Items action block with an ODATA Order By expression that allows you to identify the file in the list. In the following screenshot I am ordering the column "Last Modified" in order to get the most recent item in the list. Please note this approach may not be valid if you receive several emails almost simoultaneously

3. Add a Compose action block and apply WDL expressions to transform Get Items Array output into an Item ID valid format

4. Add an SP Update item, applying ListName and Item ID as inputs. I tested it last week, and once the GUI identified the List Name, it dinamically added Custom Metadata as input fields.

 

workaround2_metadata.png

 

 

If your internal procedure allows you to execute the next step manually... I would suggest to follow the workaround I described at the beginning of the thread instead.

 

Does anyone currently have a more efficient way to update Document Library custom metadata? Please let us know!

I'm afraid the workarounds I described above are like a shaggy dog story, but they're the only way I've found so far to achieve this

ashmon07
Level: Powered On

Re: Workaround to update SharePoint document metadata custom columns

Does this work for getting the versioning check in comment? I can't see the dynamic content for getting the "check in" comment that pops up when approval is required for check in. 

Chewitt-1877
Level: Powered On

Re: Workaround to update SharePoint document metadata custom columns

Hi,

 

I have a particular challenge which I have not been able to overcome with a workflow. Previously I have used a sharepoint list which includes a document attached to each record, however this has limitations for powerapps and is not user friendly to search or find the relevant document (there are 2.316 records). I managed to write a flow which extracted the server URL for an attachment in the list but this only worked for the first record.  On further reading of online blogs .etc the recommendations are the information is added to the document as metadata, because this is better for long term document management?

 

With this in mind, I have now set up a folder containing all the documents on a sharepoint subsite

 

I have created and populated a sharepoint list from an excel worksheet using the import app. This list is located in the same subsite as the folder.

 

The sharepoint list contains additional information (number, Boolean, text) for each of the documents contained in the document folder.

 

The sharepoint list contains a column with the file name of the document, therefore each record in the list is associated with a unique document.

 

I have added custom columns to the document folder so they match the column headers contained in the sharepoint list and made sure the column types match.

 

I have been trying to create a flow which will run once, manually triggered. Its purpose is to add the information contained in the sharepoint list as metadata to the documents stored in the document folder, i have been trying to use the document filename as the ID as this is the unqiue value in common to both sources.

 

Once the metadata is added to the documents folder, the seperate list no longer serves a purpose and can be deleted.

 

All future updates to the documents and their metadata is carried out through an app

 

I'm new to flow, and I'm pulling my hair out a bit at this, in part i have been relying on dynamic content but this does not appear to be available for all triggers.  Any advice, tips, pointers solutions are greatefully received.

Helpful resources

Announcements
firstImage

Microsoft Flow Online Conference

Join us for a FULL day of FREE Microsoft Flow Sessions from some of the best minds in the industry!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 184 members 5,212 guests
Please welcome our newest community members: