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

m365 spo homesite remove fails

Open reshmee011 opened this issue 1 year ago • 8 comments

Priority

(Low) Something is a little off

Description

m365 spo homesite remove fails with Error: Operation is not valid due to the current state of the object.

The code will need to be refactored to use _api/SPO.Tenant/RemoveTargetedSite with additional parameter to accept siteUrl.

Steps to reproduce

m365 spo homesite remove

Expected results

Removes the Home Site

Actual results

Error: Operation is not valid due to the current state of the object. image

Diagnostics

No response

CLI for Microsoft 365 version

v10.1.0

nodejs version

v20.8.1

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

No response

reshmee011 avatar Nov 16 '24 17:11 reshmee011

As discussed previously, it is important to note that the new option url should be an optional parameter. Since CLI requires backward compatibility, we cannot introduce breaking changes just yet. This is something we should do in v11.

@reshmee011, are willing to work on this one, or should we open it up?

milanholemans avatar Nov 16 '24 18:11 milanholemans

@milanholemans : I have added a note for url to be optional.

reshmee011 avatar Nov 16 '24 18:11 reshmee011

As discussed previously, it is important to note that the new option url should be an optional parameter. Since CLI requires backward compatibility, we cannot introduce breaking changes just yet. This is something we should do in v11.

Even if the command doesn't work without it? If the underlying API has changed and it now requires the URL, then I suggest that we consider it a bug fix rather than a breaking change and make it required.

waldekmastykarz avatar Nov 20 '24 18:11 waldekmastykarz

Even if the command doesn't work without it? If the underlying API has changed and it now requires the URL, then I suggest that we consider it a bug fix rather than a breaking change and make it required.

It's not really a bug I think. These commands were built when you could only register one home site. The APIs of the commands also only work if one home site is configured. Anyway, Microsoft decided that you can create multiple home sites now, but the APIs we are using now throw errors when you have multiple configured. They only work if you have 1 home site configured.

milanholemans avatar Nov 20 '24 18:11 milanholemans

Util we refactor the command for the next major version, we should consider this known issue and print it in the output that it's the likely culprit of the issue that the user is experiencing to help them understand what's wrong and how to fix it.

waldekmastykarz avatar Dec 30 '24 14:12 waldekmastykarz

Util we refactor the command for the next major version, we should consider this known issue and print it in the output that it's the likely culprit of the issue that the user is experiencing to help them understand what's wrong and how to fix it.

Agreed. Therefore, I think for now we should add an optional option url to remove a specific home site. When this parameter is specified, we'll use the new API, otherwise, the old one is used, and we should output a deprecation message as well. In the next major release, we should make this a required option.

milanholemans avatar Mar 16 '25 13:03 milanholemans

Agreed. Therefore, I think for now we should add an optional option url to remove a specific home site. When this parameter is specified, we'll use the new API, otherwise, the old one is used, and we should output a deprecation message as well. In the next major release, we should make this a required option.

Can I make the suggested changes?

Saurabh7019 avatar May 12 '25 14:05 Saurabh7019

Sure @Saurabh7019, thanks!

milanholemans avatar May 12 '25 15:05 milanholemans