cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AH-CSUCI
Regular Visitor

Obtaining Filename - OneDrive for Business

Hello, Power Automate Community:

 

My objective is to create a flow that creates a copy of a file from OneDrive for Business and moves the copy into an archive folder. When creating the new file, I want to append the current date to the new filename. I have figured out how to append the date (and extension) to the file created by taking the file content, but I want to initialize a variable to concatenate using the original file's name. How would I initialize this variable with the original file name?

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
v-liwei-msft
Community Support
Community Support

Hi @AH-CSUCI 

 

I totally agree with @lbendlin 's idea that the name of the file can be obtained using Get file metadata.

Could you please show detailed screenshots of your flow?

How did you enter the file ID in Get file metadata?

 

vliweimsft_0-1664181832366.jpeg

 

 

Best Regards,

Levi

View solution in original post

7 REPLIES 7
lbendlin
Impactful Individual
Impactful Individual

You use "Get File Metadata" (for example)  and then you can access these fields as needed.

 

lbendlin_0-1664146845485.png

 

Thank you for this information. It's odd that I receive the following error when attempting to obtain the file name using the Get File Metadata step:

 

{
  "status"400,
  "message""The file id '/Certs/AccomplishmentsFall2021-Spring2022.docx' is not valid.",
  "source""api.connectorp.svc.ms"
}
 
I am able to obtain the file content of the exact same file using the "Get File Content" step.
 
Any further suggestions? Thank you for your assistance.
v-liwei-msft
Community Support
Community Support

Hi @AH-CSUCI 

 

I totally agree with @lbendlin 's idea that the name of the file can be obtained using Get file metadata.

Could you please show detailed screenshots of your flow?

How did you enter the file ID in Get file metadata?

 

vliweimsft_0-1664181832366.jpeg

 

 

Best Regards,

Levi

lbendlin
Impactful Individual
Impactful Individual

In that case use "Get file metadata using path"

v-liwei-msft
Community Support
Community Support

Hi @lbendlin 

 

Please show your screenshots, thank you very much!

 

Best Regards,

Levi

lbendlin_0-1664378870398.png

 

AH-CSUCI
Regular Visitor

Thank you all.

 

The solution worked. I had just been pointing to the wrong file, which I had ended up deleting. I need more coffee, it seems.

 

Thanks again,

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.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,751)