cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
cjanow
Level: Powered On

Delete pdf file in SharePoint when record is deactivated

Hi all,

 

In Dynamics 365, we have an entity that has a field dedicated to storing the direct URL to a pdf stored in SharePoint.  Upon Deactivating this record, I would like to first delete the pdf held at that link and then delete the record itself.  It appears that I cannot get the properties of the file using only a direct link.  Can anyone provide some insight?

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Delete pdf file in SharePoint when record is deactivated

 

Hi @cjanow ,

 

If the File link is in the following format, then you can refer to the following methods to achieve your needs.

https://domin.sharepoint.com/sites/SiteName/LibraryName/FileName
  • Use the split() function to get the file path, use SiteName as the split point.
  • Then use Get file metadata using path to get the identifier of the corresponding file, and finally delete the file.

Expression reference:

last(split(outputs('FileLink'),'SiteName'))

Image reference:

93.PNG

 

Best Regards,

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

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Delete pdf file in SharePoint when record is deactivated

 

Hi @cjanow ,

 

If the File link is in the following format, then you can refer to the following methods to achieve your needs.

https://domin.sharepoint.com/sites/SiteName/LibraryName/FileName
  • Use the split() function to get the file path, use SiteName as the split point.
  • Then use Get file metadata using path to get the identifier of the corresponding file, and finally delete the file.

Expression reference:

last(split(outputs('FileLink'),'SiteName'))

Image reference:

93.PNG

 

Best Regards,

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

View solution in original post

cjanow
Level: Powered On

Re: Delete pdf file in SharePoint when record is deactivated

My URL was a little different but I was able to piece together my solution based on info you provided.  Thanks!

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

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!

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 Power Automate Community Video Gallery!

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