pnp/cli-microsoft365

New command: `spo tenant site archive`

Closed this issue ยท 7 comments

Usage

m365 spo tenant site archive [options]

Description

Archives a site collection

Options

Option Description
-u, --url <url> URL of the site collection.
-f, --force Don't prompt for confirmation.

Examples

Archive a specific SharePoint site collection

m365 spo tenant site archive --url "https://contoso.sharepoint.com/sites/Marketing"

Archive a specific SharePoint site collection without confirmation prompt

m365 spo tenant site archive --url "https://contoso.sharepoint.com/sites/Marketing" --force

Default properties

No response

Additional Info

API request

Since the REST API request is an internal request, we prefer to use the CSOM request.

POST https://contoso-admin.sharepoint.com/_vti_bin/client.svc/ProcessQuery

<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="<CLI app name>"
	xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
	<Actions>
		<ObjectPath Id="2" ObjectPathId="1" />
		<ObjectPath Id="4" ObjectPathId="3" />
		<Query Id="5" ObjectPathId="3">
			<Query SelectAllProperties="true">
				<Properties />
			</Query>
		</Query>
	</Actions>
	<ObjectPaths>
		<Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" />
		<Method Id="3" ParentId="1" Name="ArchiveSiteByUrl">
			<Parameters>
				<Parameter Type="String">https://contoso.sharepoint.com/sites/Marketing</Parameter>
			</Parameters>
		</Method>
	</ObjectPaths>
</Request>

Remarks

Note

Info admonition: To use this command you must be a Global or SharePoint administrator.

Additional info

LGTM ๐Ÿ‘
Only idea I had (similar like in the unarchive) was maybe to allow to specify site by name.

Can I work on this one?

Definitely! Thanks.

@pnp/cli-for-microsoft-365-maintainers since this command is an admin command, shouldn't we move this under the spo tenant umbrella?

@pnp/cli-for-microsoft-365-maintainers since this command is an admin command, shouldn't we move this under the spo tenant umbrella?

yes, this makes sense ๐Ÿ‘

@Saurabh7019 could you rename the command to spo tenant site archive in your PR please? Sorry for the late turnaround.

Sure, I will work on it today!