pnp/cli-microsoft365

Bug report: `spo tenant recyclebinitem restore` doesn't restore group

Closed this issue · 3 comments

Priority

(Medium) I'm annoyed but I'll live

Description

When using spo tenant recyclebinitem restore on a team site, the connected group remains in the recycle bin.

Steps to reproduce

Run m365 spo tenant recyclebinitem restore -u https://contoso.sharepoint.com/sites/Marketing on any teams site in the SharePoint recycle bin with its connected group in the group recycle bin.

Expected results

Restore both the group and the site.

Actual results

Only the site is restored, not the group.

Diagnostics

No response

CLI for Microsoft 365 version

v7.8.0

nodejs version

v20.10.0

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

In this command, we're using a SPOInternalUseOnly.Tenant endpoint. However it seems like the UI is using the same request, the UI restores the group without any problem, while this command doesn't.
Maybe we should look to an alternative endpoint.

  • We should also fix the response type of the request, right now, if the request returns an error, it's not parsed as JSON which makes the error hard to read.
    image

Good catch. Let's create a separate issue for fixing showing the error message

Good catch. Let's create a separate issue for fixing showing the error message

Is that necessary? The only thing we have to do to fix this is add a response type in the request object.

const requestOptions: CliRequestOptions = {
url: `${adminUrl}/_api/SPOInternalUseOnly.Tenant/RestoreDeletedSite`,
headers: {
accept: 'application/json;odata=nometadata',
'content-type': 'application/json;charset=utf-8'
},
data: {
siteUrl: args.options.siteUrl
}
};

Can I work on this?