Forum Discussion

MichaelStephens1655's avatar
MichaelStephens1655
Copper Contributor
Feb 14, 2024

M365/ SharePoint Online Archive - Redirect URL

I understand that SharePoint Online Archive has recently launched, but I cannot get the Powershell script for the redirect URL (ArchiveRedirectURL) to work. I asked Co-Pilot with the response to use the NoAccessRedirectURL, but I'm afraid that will redirect all access denied requests. There are 2 issues:

1. LockState is invalid. I believe the LockState should be Archive, or is it NoAccess?

2. I don't think the Parameter/flag ArchiveRedirectURL is available, even with the latest SharePoint module. End user experience in Microsoft 365 Archive (Preview) - Microsoft 365 Archive | Microsoft Learn

 

Anyone try this Archive Redirect yet?

 

Here is Co-Pilot's script suggestion:

# Connect to your SharePoint Online tenant (you'll be prompted for credentials)
Connect-SPOService -Url https://ausenco-admin.sharepoint.com

# Set the ArchiveRedirectURL for all site collections
Get-SPOSite | ForEach-Object {
Set-SPOSite -Identity $_.Url -LockState Archive
Set-SPOSite -Identity $_.Url -ArchiveRedirectUrl https://tsshelp.ausenco.com/catalog_items/2042293-archived-sharepoint-site-reactivation/service_requests/new
}

# Disconnect from SharePoint Online
Disconnect-SPOService

  • MichaelStephens1655 

     

    -ArchiveRedirectUrl parameter is not available for Set-SPOSite PowerShell command.  

     

    Check below Microsoft official documentations for the commands and parameters reference:

    1. Set-SPOTenant 
    2. Set-SPOSite 

    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

  • BarryGoblon's avatar
    BarryGoblon
    Iron Contributor

    MichaelStephens1655 First off, you're spot on about the ArchiveRedirectURL parameter being unavailable in the current SharePoint Online Management Shell module. This archive redirect functionality for sites is still in preview, so PowerShell support may be limited for now. As for the LockState, you're correct that 'Archive' should be the appropriate value when archiving a site collection. The other valid options are Unlocked, NoAccess, and ReadOnly. However, since that ArchiveRedirectURL parameter seems inaccessible via PowerShell currently, we'll need to explore alternatives. One potential avenue could be leveraging the Microsoft Graph API directly or through an SDK, as it exposes the 'archiveRedirectUrl' property when archiving sites.

     

    Alternatively, you could consider raising a support case with Microsoft. Their team may provide insights into the current status and any available workarounds for setting the custom archive URL redirect through PowerShell or other methods. In the interim, a possible workaround, albeit not ideal, might involve using the NoAccessRedirectURL parameter instead. This would redirect all access-denied requests, including archived sites, to the specified URL. Though, as you mentioned, it may not be the most suitable solution if you need a more targeted redirect for archived sites specifically.

     

    Here's an example of how you could set that NoAccessRedirectURL using PowerShell as a temporary measure:

    # Connect to SharePoint Online 
    Connect-SPOService -Url https://yourTenant.sharepoint.com
    
    # Set NoAccessRedirectURL for all site collections
    Get-SPOSite | ForEach-Object {
        Set-SPOSite -Identity $_.Url -NoAccessRedirectUrl "https://your-archive-redirect-url"  
    }
    
    # Disconnect from SharePoint Online
    Disconnect-SPOService

    Moving forward, as the Archive functionality evolves from preview, more options and PowerShell support may become available. Keeping tabs on official documentation and maintaining an open support case could unveil more tailored solutions aligning with your requirements.

Resources