Set an Expiration Date for Files Shared on OneDrive
When sharing an item (file or folder) with others with OneDrive or SharePoint, you have the option to set an expiration date on the link to the shared item. After the expiration date, those with the link with will no longer have access.
In order to have an expiration date on the share, you need to use the Share link option and have visibility set to Anyone. When using “Anyone”, be sure to use a password if you are granting Edit access. Learn more at Share Microsoft 365 files with External Users.