Share via

-ApplyToNewDocumentLibraries is not taking effect inside Set-SPOSite

john john Pter 1,550 Reputation points
2025-04-01T18:44:45.4366667+00:00

I run this command to set the version limit for a site and to apply this to new and existing libraries:-

Set-SPOSite -Identity https://*.sharepoint.com -EnableAutoExpirationVersionTrim $false -MajorVersionLimit 15 -MajorwithMinorVersionsLimit 10 -ExpireVersionsAfterDays 300 -ApplyToNewDocumentLibraries -ApplyToExistingDocumentLibraries

but this script set the limit to existing libraries, but new libraries will still have the version limit from the tenant and not from the site .. so why the "-ApplyToNewDocumentLibraries" paramter inside the above script did not take impact?

Microsoft 365 and Office | SharePoint | Development
0 comments No comments

1 answer

Sort by: Most helpful
  1. AllenXu-MSFT 24,991 Reputation points Moderator
    2025-04-02T02:52:01.75+00:00

    Hi @john john Pter,

    Try executing two commands separately:

    Set-SPOSite -Identity https://*.sharepoint.com -EnableAutoExpirationVersionTrim $false -MajorVersionLimit 15 -MajorwithMinorVersionsLimit 10 -ExpireVersionsAfterDays 300 -ApplyToNewDocumentLibraries 
    

    and

    Set-SPOSite -Identity https://*.sharepoint.com -EnableAutoExpirationVersionTrim $false -MajorVersionLimit 15 -MajorwithMinorVersionsLimit 10 -ExpireVersionsAfterDays 300 -ApplyToExistingDocumentLibraries
    

    Changes might take time to apply. New libraries created immediately after the command might not reflect updates.


    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.

    Was this answer helpful?

    0 comments No comments

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.