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:
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!
Solved! Go to Solution.
Thank you very much for your time, let me show you the full story
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:
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...):
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.
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.
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
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.