SharePoint Teams Sites - Guest Expiry settings?

Rob 86 Reputation points
2025-10-10T16:13:04.3666667+00:00

Hi,

At tenant level we the "Guest access to a site or OneDrive will expire automatically after this many days" configured. This works great for 99% of the sites. However we have a requirement with a single site to remove this restriction. The problem is that the site was created by Teams and is a channel. If this was a "proper" SharePoint site we can configure this in the "more sharing settings" from within SharePoint admin portal. However this site being a Teams site doesn't have any of these options, is there any way to exclude this site from the main expiry policy? (maybe a bit of PowerShell)?

Thanks

Microsoft Teams | Microsoft Teams for business | Files | Find and share files
{count} votes

Answer accepted by question author
  1. Jay Tr 6,125 Reputation points Microsoft External Staff Moderator
    2025-10-10T17:04:41.9333333+00:00

    Hi @Rob

    Thank you for posting your question in the Microsoft Q&A forum. 

    Regarding your description, in order to override the tenant-level external user expiry, I would recommend trying the PowerShell approach. Below is the PowerShell script that shows how to overcome the organization expiry policy. 

     
    Set-SPOSite -Identity "https://yourtenant.sharepoint.com/sites/yourteamsite" `
    -OverrideTenantExternalUserExpirationPolicy $true `
    -ExternalUserExpirationInDays 0
    

    Explanation of parameter in the script:  

    • OverrideTenantExternalUserExpirationPolicy $true: This tells SharePoint to ignore the external user expiration policy on this specific site.  
    • ExternalUserExpirationInDays 0: This disables guest expiration entirely for the site.  

      

    For more information, please refer to this article: Set-SPOSite (Microsoft.Online.SharePoint.PowerShell) | Microsoft Learn

      

    Please note:  

    • In order to perform this, you must be a Global Admin in your organization. If you are an end-user, please contact your IT admin to help you with this.   
    • To run the script above, you must install the Microsoft SharePoint PowerShell module.  

    I hope this helps you successfully exclude the guest expiration policy from your SharePoint site using PowerShell. I'm happy to assist and truly hope the information provided has been clear and useful. If you need further help with the PowerShell command or verifying the site settings, feel free to reach out anytime. 

    If you find this post helpful, please consider marking it as the accepted answer. Doing so can help others in the community with similar questions find solutions more quickly. 

    Thank you for your engagement and contributions to the forum. 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.     

    image

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.