pnp/cli-microsoft365

➜ m365 spo homesite set throwing Error: Operation is not valid due to the current state of the object.

Opened this issue · 8 comments

Priority

(Low) Something is a little off

Description

The cmdlet m365 spo homesite set -u https://reshmeeauckloo.sharepoint.com/sites/contosoportal is throwing "Error: Operation is not valid due to the current state of the object."
image

Steps to reproduce

Go to Office 365 admin center -> Settings -> Viva -> Viva connections
Ensure there are multiple Viva Connections.
In my instance I have

m365 spo homesite set -u https://reshmeeauckloo.sharepoint.com/sites/contosoportal is throwing "Error: Operation is not valid due to the current state of the object."

Expected results

The home site is set without any errors thrown

Actual results

The home site is not set and error"Error: Operation is not valid due to the current state of the object." is thrown

Diagnostics

No response

CLI for Microsoft 365 version

v7.9.0

nodejs version

v20.8.1

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

No response

I can work on the bug after it has been reviewed.

Thank you for reporting this @reshmee011, your help is much appreciated!

@reshmee011 since it's possible now to specify more than one home site, do you think it would make sense to rename the command to spo homesite add?

spo homesite add will add another homesite which can be a different cmdlet definitely and spo homesite set will update an existing home site with additional values.

If there multiple viva connection experiences are enabled at the tenant, i.e. Tenant Property "IsMultipleVivaConnectionsFlightEnabled", the endpoint UpdateTargetedSite is called. Otherwise SetSPHSiteWithConfiguration is called with the additional properties DraftMode.

Thank you @reshmee011, sounds like a plan. Let's get this command fixed and see if we can implement a spo homesite add command as well.
This would mean that the option vivaConnectionsDefaultStart will have to be required for the spo homesite set command. (breaking change so that's for V8).

@reshmee011 are you still working on this?

@milanholemans: hope you are doing fine. I work on one PR at a time , I am just waiting for the PR I created to be merged before starting to work on this one. Happy to let someone else work on it. I’ll pick up another issue once my current PR is merged.

Ok, thank you for letting us know. We had a lot of open PRs, but the amount is gradually dropping. We'll try to pick up your open PR ASAP.