cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Sharepoint File Action should make FileID available!

How can i obtain the FileID for a newly created Sharepoint file in a flow which copies a file from onedrive for business.

i want to use the id in the next step to change document properties

there is only the FileSize available as dynamic content in the next action!!!

7 REPLIES 7
Highlighted
Advocate II
Advocate II

How to get the ID of new Sharepoint file after copying it from onedrive

I need the sharepoint file id in the next action after creating it by copying from onedrive.

 

I want to update the file properties after the file is copied from a onedrive folder.

 

Can anybody help?

Highlighted
Community Support
Community Support

Re: How to get the ID of new Sharepoint file after copying it from onedrive

Hi @Tpuehri,

 

If you mean to update the File property, then I don't think File identifier would be helpful here.

It would need to use the Item Id to update the corresponding item (file properties) fields.

And this is not a property provided by the create file Action.

We need first take use of the SharePoint ->Get Files(properties only ), then add a filter to find the proper item and then update the corresponding field:

See screenshots:

68.PNG

 

The formula used under the Condition is the following:

@equals(
           items('Apply_to_each')?['{Name}'], 
           first(
              split(body('Create_file')?['DisplayName'],'.')
                  )
             )

This is because the Name or the DisplayName content from the Create File content would contain the file extension, while the Name content from the Get Files(property only) don't contain the file extension, so to make the condition work, we need to split the DisplayName field.

Please check and see if this would work for you.

Running results from my side:

69.PNG

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Advocate II
Advocate II

Re: How to get the ID of new Sharepoint file after copying it from onedrive

Hello,

 

thank you!

I will test it.

 

Is there a documentation available on the commands you are using. Like @equals, split, body etc.

I am trying to figure out how to use them.

i did not get the meaning of body('Create File') yet. 

 

 

Highlighted
Community Support
Community Support

Re: How to get the ID of new Sharepoint file after copying it from onedrive

Yes,

See the documentation here:

WorkFlow Definition Language

 

Body('Create File' ) represents the Response Body of the SharePoint Create File Action,

And the Item('Apply_to_each') show the each item record data.

 

Post back if you need any further help on this.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Advocate II
Advocate II

Re: How to get the ID of new Sharepoint file after copying it from onedrive

Hello,  

tested your suggested action but it runs into an error.

I think it is related to the input data for metadata columns.

 

05-08-_2017_16-36-39.png05-08-_2017_16-41-47.png

Highlighted
Advocate II
Advocate II

Re: How to get the ID of new Sharepoint file after copying it from onedrive

Additionally i am trying to delete the file from onedrive for business after copying it to sharepoint.

unfortunately the file is not deleted. i am using the fileid of onedrive05-08-_2017_19-10-30.png

Highlighted
Advocate II
Advocate II

Re: How to get the ID of new Sharepoint file after copying it from onedrive

i am not succeeding to update my metdata field which has a choice list (menu).

I am able to update text fields but no other field types.

 

Do i need a special function for updating?

Helpful resources

Announcements
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!

Top Solution Authors
Top Kudoed Authors
Users online (6,191)