cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
YamiteKudasai
Helper IV
Helper IV

[HELP] - DELETE SHAREPOINT LIBRARY FOLDER WHEN ITEM IN LIST IS DELETED

Hi Everyone

Good day! 

I would like to ask for your help regarding the scenario below:

I have a list named request attachments. This attachments contains column request id, path of file etc.

the files are stored in a sharepoint library named Attachments and with the subfolder of request attachments request id column. 

My question is. How to delete the subfolder in Attachments when an item in request attachments is deleted.?

 

 

 

If I delete request id 1 in request attachments list. It will also delete folder named "1" in Attachments directory folder. 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @YamiteKudasai ,

 

To achieve this, the 'For a selected item' trigger should be used instead of 'when an item is deleted' because the second trigger doesn't return any column value e.g. request id, path...

So we can't delete the item directly, instead we select an item and run the flow. The flow will delete the item and folder.

Sample:

vxiaochenmsft_0-1663125674377.png

vxiaochenmsft_1-1663125685210.png

vxiaochenmsft_2-1663125710460.png

vxiaochenmsft_3-1663125749426.png

ContentType eq 'Folder' and RequestId eq '@{outputs('Get_item')?['body/RequestId']}'

 

vxiaochenmsft_4-1663125841749.png

 

vxiaochenmsft_5-1663125973632.png

 

vxiaochenmsft_6-1663126036284.png

 

Best Regards,

Wearsky

View solution in original post

1 REPLY 1
v-xiaochen-msft
Community Support
Community Support

Hi @YamiteKudasai ,

 

To achieve this, the 'For a selected item' trigger should be used instead of 'when an item is deleted' because the second trigger doesn't return any column value e.g. request id, path...

So we can't delete the item directly, instead we select an item and run the flow. The flow will delete the item and folder.

Sample:

vxiaochenmsft_0-1663125674377.png

vxiaochenmsft_1-1663125685210.png

vxiaochenmsft_2-1663125710460.png

vxiaochenmsft_3-1663125749426.png

ContentType eq 'Folder' and RequestId eq '@{outputs('Get_item')?['body/RequestId']}'

 

vxiaochenmsft_4-1663125841749.png

 

vxiaochenmsft_5-1663125973632.png

 

vxiaochenmsft_6-1663126036284.png

 

Best Regards,

Wearsky

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.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,048)