Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command: spo site unarchive #6019

Open
Tracked by #5982
milanholemans opened this issue May 3, 2024 · 8 comments · May be fixed by #6043
Open
Tracked by #5982

New command: spo site unarchive #6019

milanholemans opened this issue May 3, 2024 · 8 comments · May be fixed by #6043

Comments

@milanholemans
Copy link
Contributor

milanholemans commented May 3, 2024

Usage

m365 spo site unarchive [options]

Description

Unarchives a site collection

Options

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

Examples

Unarchive a specific site collection

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

Unarchive a specific site collection without confirmation prompt

m365 spo site unarchive --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="8" ObjectPathId="7" />
		<ObjectPath Id="10" ObjectPathId="9" />
		<Query Id="11" ObjectPathId="9">
			<Query SelectAllProperties="true">
				<Properties />
			</Query>
		</Query>
	</Actions>
	<ObjectPaths>
		<Constructor Id="7" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" />
		<Method Id="9" ParentId="7" Name="GetSitePropertiesByUrl">
			<Parameters>
				<Parameter Type="String">https://contoso.sharepoint.com/sites/Marketing</Parameter>
				<Parameter Type="Boolean">false</Parameter>
			</Parameters>
		</Method>
	</ObjectPaths>
</Request>

Remarks

Note

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

Warning

If a site remains archived for more than seven days, the reactivation fee will be calculated based on the entire storage capacity of the site.

Additional info

@milanholemans milanholemans added new feature needs peer review Needs second pair of eyes to review the spec or PR labels May 3, 2024
@Adam-it
Copy link
Contributor

Adam-it commented May 4, 2024

Seems solid 👍
some ideas I have are:

  • what if we also allow to specify site by name? and we solve to get the URL. if we find more than one site with the same name we show a prompt to pick based on URL?
  • what if we add a --all option which will basically unarchive everything?

@milanholemans
Copy link
Contributor Author

* what if we also allow to specify site by name? and  we solve to get the URL. if we find more than one site with the same name we show a prompt to pick based on URL?

I don't mind, however, as far as I know, we don't do this like this at other places.

* what if we add a `--all` option which will basically unarchive everything?

In that case, I'd opt for a separate command, no? I also don't know if this is something that people want to do because every restored site is billed (unless it's been archived less than 7 days ago).

@Adam-it
Copy link
Contributor

Adam-it commented May 4, 2024

also does this need to be an absolute URL? I think we support specifying just the relative path as CLI is aware of the host part of the URL right?

@Adam-it
Copy link
Contributor

Adam-it commented May 4, 2024

* what if we also allow to specify site by name? and  we solve to get the URL. if we find more than one site with the same name we show a prompt to pick based on URL?

I don't mind, however, as far as I know, we don't do this like this at other places.

Correct. Lets leave it as is then 👍

* what if we add a `--all` option which will basically unarchive everything?

In that case, I'd opt for a separate command, no? I also don't know if this is something that people want to do because every restored site is billed (unless it's been archived less than 7 days ago).

Good point. If anything that also could be a script sample rather than a command👍

@milanholemans
Copy link
Contributor Author

milanholemans commented May 4, 2024

also does this need to be an absolute URL? I think we support specifying just the relative path as CLI is aware of the host part of the URL right?

Technically speaking, yes. But as far as I know, we support this anywhere. That's something we could implement for all commands, like spo list get --webUrl "/sites/project-x" ....

@Adam-it
Copy link
Contributor

Adam-it commented May 4, 2024

also does this need to be an absolute URL? I think we support specifying just the relative path as CLI is aware of the host part of the URL right?

Technically speaking, yes. But as far as I know, we support this anywhere. That's something we could implement for all commands, like spo list get --webUrl "/sites/project-x" ....

I am not sure this is something we have to implement as I think it is already done for all SPO commands

options[optionName] = auth.connection.spoUrl + optionValue;

in the example you gave it also works this way as well
image

I think there is just no point stating that it is absolute URL in the spec as it may be either this or that

@milanholemans
Copy link
Contributor Author

Aw yeah, totally forgot spo commands transform all URLs by default 😊

@Jwaegebaert Jwaegebaert added help wanted and removed needs peer review Needs second pair of eyes to review the spec or PR labels May 6, 2024
@MathijsVerbeeck
Copy link
Contributor

Can I work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants