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

m365 spo homesite set #6489

Open
reshmee011 opened this issue Nov 16, 2024 · 5 comments
Open

m365 spo homesite set #6489

reshmee011 opened this issue Nov 16, 2024 · 5 comments

Comments

@reshmee011
Copy link
Contributor

reshmee011 commented Nov 16, 2024

Usage

m365 spo homesite set

Description

Updates the Viva Connections Experience / SharePoint home site settings like draft status , audiences and target license type

Options

Option Description
-u, --url <url> Url of the Home Site
-d, --draftMode [draftMode] Set draft status. The default value is false.
-a, --audienceIds [audienceIds] Array of M365 group Ids to set as audiences
-a, --audienceNames [audienceNames] Array of M365 group names to set as audiences
-t, --targetedLicenseType [TargetedLicenseType] Value of either everyone, frontLineWorkers or informationWorkers

Examples

Disables the Home site viva connection experience

m365 spo homesite set -u https://contoso.sharepoint.com/sites/contosoportal  --draftMode false

Enables the Home site viva connection experience

m365 spo homesite set -u https://contoso.sharepoint.com/sites/contosoportal  --draftMode true

Set the audience to everyone

m365 spo homesite set -u https://contoso.sharepoint.com/sites/contosoportal  --TargetedLicenseType "everyone"

Set the audience to frontline workers

m365 spo homesite set -u https://contoso.sharepoint.com/sites/contosoportal  --TargetedLicenseType "frontLineWorkers"

Set the audience to information workers

m365 spo homesite set -u https://contoso.sharepoint.com/sites/contosoportal  --TargetedLicenseType "informationworkers"

Set the audience to M365 groups using M365 Groups Ids

m365 spo homesite set -u https://contoso.sharepoint.com/sites/contosoportal  --audienceIds "978b5280-4f80-47ea-a1db-b0d1d2fb1ba4,21af775d-17b3-4637-94a4-2ba8625277cb"

Set the audience to M365 groups using M365 Groups Names

m365 spo homesite set -u https://contoso.sharepoint.com/sites/contosoportal  --audienceNames "Marketing, IT department"

Default properties

No response

Additional Info

This is to fix the bug #6066 which requires a refactor to use a different REST endpoint UpdateTargetedSite following the changes to the SharePoint Home Site being merged into Viva Connection Experiences.

The parameter vivaConnectionsDefaultStart seems redundant and I can't find how to use the REST endpoint SetSPHSiteWithConfiguration and hence can be removed.

Happy to work on it after peer review.

@milanholemans
Copy link
Contributor

Hi @reshmee011 once again thanks a lot for the effort put in this issue. These are my remarks:

  • Just like the other command, could we rephrase the description a bit?
  • For the options, I suggest that we use url instead of siteUrl. And as a description, let's use just something like URL of the home site.
  • It totally makes sense that option url is required. However, this is something we cannot enforce now. CLI for Microsoft 365 minor versions are always backward compatible. I suggest that we make the option optional. If it's not provided, we should display a warning that this way of working is getting deprecated.
  • Option draftMode has an incorrect >.
  • For draftMode let's make clear that we take false as default value when the option is not provided.
  • Instead of one option audiences, I suggest we provide a parameter audienceIds and audienceNames. For the first, people can provide GUIDs of groups. For the latter, they can provide display names.
  • For TargetedLicenseType, let's make it start with a small letter. Also instead of providing some integers like 0, 1, 2, I suggest that we provide some more user-friendly values like everyone, frontLineWorkers, ...

The parameter vivaConnectionsDefaultStart seems redundant and I can't find how to use the REST endpoint SetSPHSiteWithConfiguration and hence can be removed.

Thinking out loud, is this endpoint something we could use? https://s-kainet.github.io/sp-rest-explorer/#/_api/SP.SPHSite/SetSPHSite

@reshmee011
Copy link
Contributor Author

@milanholemans: Thanks so much for the review helping to improve the specs. Please find my comments in line with the questions.

• I have updated the description.
• For the options, I suggest that we use url instead of siteUrl. And as a description, let's use just something like URL of the home site. Done
• It totally makes sense that option url is required. However, this is something we cannot enforce now. CLI for Microsoft 365 minor versions are always backward compatible. I suggest that we make the option optional. If it's not provided, we should display a warning that this way of working is getting deprecated. siteUrl is already required as per documentation https://pnp.github.io/cli-microsoft365/cmd/spo/homesite/homesite-set/. I have updated it to url instead of siteUrl. For backward compatibility I can leave it to be SiteUrl
• Option draftMode has an incorrect >. I have corrected it
• For draftMode let's make clear that we take false as default value when the option is not provided. Done
• Instead of one option audiences, I suggest we provide a parameter audienceIds and audienceNames. For the first, people can provide GUIDs of groups. For the latter, they can provide display names. Added both separate.
• For TargetedLicenseType, let's make it start with a small letter. Also instead of providing some integers like 0, 1, 2, I suggest that we provide some more user-friendly values like everyone, frontLineWorkers, . Corrected to accept user friendly options
• The parameter vivaConnectionsDefaultStart seems redundant and I can't find how to use the REST endpoint SetSPHSiteWithConfiguration and hence can be removed.
Thinking out loud, is this endpoint something we could use? https://s-kainet.github.io/sp-rest-explorer/#/_api/SP.SPHSite/SetSPHSite

I have tried /_api/SP.SPHSite/SetSPHSite with vivaConnectionsDefaultStart and it threw same error as bug #6066.

From the browser's developer tools I deduced the endpoint UpdateTargetedSite being used. Also I tested against a multiple viva connection experiences. Depending on license, i.e. Microsoft 365 subscription (E, F, or A license) , end users are restricted to one experience which I have tested the different combinations.

@milanholemans
Copy link
Contributor

I have updated it to url instead of siteUrl. For backward compatibility I can leave it to be SiteUrl

Yes, that's true indeed, let's leave it named siteUrl, the name of this option is something we can change in the next major release (v11). Sorry for the miscommunication!

A few other remarks:

  • audienceIds and audienceNames both have a short option -a now. This is technically not possible. I suggest we just remove the short options for these two options.

I have tried /_api/SP.SPHSite/SetSPHSite with vivaConnectionsDefaultStart and it threw same error as bug #6066.

Just played a bit around with the endpoint, seems like this request is working for me:

POST https://contoso-admin.sharepoint.com/_api/SPO.Tenant/UpdateTargetedSite
{
    "siteUrl": "https://contoso.sharepoint.com",
    "configurationParam": {
        "IsInDraftModePresent": true,
        "isInDraftMode": false,
        "vivaConnectionsDefaultStart": true,
        "IsVivaConnectionsDefaultStartPresent": true
    }
}

@reshmee011
Copy link
Contributor Author

@milanholemans : I have updated it back to siteUrl and removed the short options for -1.

/_api/SPO.Tenant/UpdateTargetedSite works and does not do anything with vivaConnectionsDefaultStart parameter. I tried passing vivaConnectionsDefaultStart parameter to it but the value of vivaConnectionsDefaultStart stayed the same. I can't figure out how to use it.

@milanholemans
Copy link
Contributor

I tried passing vivaConnectionsDefaultStart parameter to it but the value of vivaConnectionsDefaultStart stayed the same. I can't figure out how to use it.

Yes, that's something I experienced as well. Not sure if this is a bug in the API, but using the Viva Engage app in Teams, the option seems to work for me.

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

No branches or pull requests

2 participants