m365 spo homesite remove fails
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.
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
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 : I have added a note for url to be optional.
As discussed previously, it is important to note that the new option
urlshould 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.
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.
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.
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.
Agreed. Therefore, I think for now we should add an optional option
urlto 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?
Sure @Saurabh7019, thanks!