When I click share from SharePoint document library files to users directly as per below then is there a way to set expiry days for those shared files to users?

As per now mechanism of email getting triggered by SharePoint itself once I share to users directly but how to manage expiry days for those sharing of files or any workaround appreciated.

enter image description here

  • You can add one Shared date column and update it when you share it with a user. Then associate a scheduled Power Automate which runs daily to check daily whether it has been 'X' days while the file is shared. If the condition falls true, then inherit the document library permission for those files. Commented Jan 6, 2023 at 10:21
  • Thanks for your inputs.appreciate if sample steps to inherit permissions for files
    – Bzl
    Commented Jan 6, 2023 at 10:29

1 Answer 1

  1. Create a schedular Power Automate
  2. Set SharedDays variable (e.g. you want to remove the sharing of the files which were shared 'X' days ago from today. Here for example, it is 2). Put a minus sign before it to calculate the date of X days ago from today.
  3. Get the SharedDateLimit variable which will have date of X days ago.

enter image description here

  1. Now get the files whose SharedDate column value is less than or equal to SharedDateLimit.

enter image description here

  1. Now add Apply to each condition to iterate through each file.
  2. In Apply to each condition, make another HTTP call to restore the permission inheritance of each file using ID. enter image description here
  • Thanks a lot. Awesome.Worked as expected
    – Bzl
    Commented Jan 6, 2023 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.