cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

New command: `spo site archive`

Open milanholemans opened this issue 1 year ago • 3 comments

Usage

m365 spo 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 site archive --url "https://contoso.sharepoint.com/sites/Marketing"

Archive a specific SharePoint site collection without confirmation prompt

m365 spo 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

  • https://learn.microsoft.com/en-us/microsoft-365/archive/archive-pricing?view=o365-worldwide

milanholemans avatar May 03 '24 22:05 milanholemans

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

Adam-it avatar May 04 '24 21:05 Adam-it

Can I work on this one?

Saurabh7019 avatar May 06 '24 06:05 Saurabh7019

Definitely! Thanks.

milanholemans avatar May 06 '24 07:05 milanholemans

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

milanholemans avatar Jun 12 '24 19:06 milanholemans

@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 👍

Adam-it avatar Jun 16 '24 00:06 Adam-it

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

milanholemans avatar Jun 16 '24 17:06 milanholemans

Sure, I will work on it today!

Saurabh7019 avatar Jun 17 '24 08:06 Saurabh7019