cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cjanow
Helper I
Helper I

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
v-bacao-msft
Community Support
Community Support

 

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
v-bacao-msft
Community Support
Community Support

 

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

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

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Kudoed Authors
Users online (3,990)