cli-microsoft365: command spo web installedlanguage list doesn't work for Hubsites

Description

command spo web installedlanguage list doesn’t work against Hubsites

Steps to reproduce

Run command m365 spo web installedlanguage list --webUrl <site_url> against a communication hubsite

Expected results

List of installed languages in a site collection similar to the output from

https://<site_url>/_api/web/RegionalSettings/InstalledLanguages

Actual results

No results

Diagnostics

No results

CLI for Microsoft 365 version

v4.0.0

nodejs version

v14.18.0

Operating system (environment)

macOS

Shell

zsh

cli doctor

{ "os": { "platform": "darwin", "version": "Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101", "release": "21.2.0" }, "cliVersion": "4.0.0", "nodeVersion": "v14.18.0", "cliAadAppId": "31359c7f-bd7e-475c-86db-fdb8c937548e", "cliAadAppTenant": "common", "authMode": "DeviceCode", "cliEnvironment": "", "roles": [], "scopes": [ "AllSites.FullControl", "AppCatalog.ReadWrite.All", "ChannelMember.ReadWrite.All", "ChannelMessage.Send", "ChannelSettings.ReadWrite.All", "Directory.AccessAsUser.All", "Directory.ReadWrite.All", "Group.ReadWrite.All", "IdentityProvider.ReadWrite.All", "Mail.ReadWrite", "Mail.Send", "Reports.Read.All", "Tasks.ReadWrite", "Team.Create", "TeamMember.ReadWrite.All", "TeamsApp.ReadWrite.All", "TeamsAppInstallation.ReadWriteForUser", "TeamSettings.ReadWrite.All", "TeamsTab.ReadWrite.All", "TermStore.ReadWrite.All", "User.Invite.All", "User.ReadWrite.All", "profile", "openid", "email", "AllSites.FullControl", "AppCatalog.ReadWrite.All", "ChannelMember.ReadWrite.All", "ChannelMessage.Send", "ChannelSettings.ReadWrite.All", "Directory.AccessAsUser.All", "Directory.ReadWrite.All", "Group.ReadWrite.All", "IdentityProvider.ReadWrite.All", "Mail.ReadWrite", "Mail.Send", "Reports.Read.All", "Tasks.ReadWrite", "Team.Create", "TeamMember.ReadWrite.All", "TeamsApp.ReadWrite.All", "TeamsAppInstallation.ReadWriteForUser", "TeamSettings.ReadWrite.All", "TeamsTab.ReadWrite.All", "TermStore.ReadWrite.All", "User.Invite.All", "User.ReadWrite.All", "AllSites.FullControl", "AppCatalog.ReadWrite.All", "ChannelMember.ReadWrite.All", "ChannelMessage.Send", "ChannelSettings.ReadWrite.All", "Directory.AccessAsUser.All", "Directory.ReadWrite.All", "Group.ReadWrite.All", "IdentityProvider.ReadWrite.All", "Mail.ReadWrite", "Mail.Send", "Reports.Read.All", "Tasks.ReadWrite", "Team.Create", "TeamMember.ReadWrite.All", "TeamsApp.ReadWrite.All", "TeamsAppInstallation.ReadWriteForUser", "TeamSettings.ReadWrite.All", "TeamsTab.ReadWrite.All", "TermStore.ReadWrite.All", "User.Invite.All", "User.ReadWrite.All" ] }

Additional Info

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (12 by maintainers)

Most upvoted comments

It’s hard for me to say when this functionality will be added I am not sure if it is on some kind of timeline 🤔. Maybe @waldekmastykarz knows more 😉. I didn’t see any opened issue for this functionality and if @alaakh42 you have some time you could open an issue for each of those as an new command suggestion so that we could check if it is supported by any rest API and add it 👍. I strongly encourage you to try to contribute 👍 but if you don’t feel like it that’s totally fine. TBH I think those are great suggestions and I think if there will be no better candidate’s I could try to take them, if I will find the time that is 😉.

Excellent! Thank you for confirming @alaakh42 👏

It is working now and I am able to retrieve the installed languages. Thanks @waldekmastykarz @Adam-it

I believe it was fixed by the upgrade for both nodejs and m365 cli

@waldekmastykarz not yet working unfortunately but I am planning to do the upgrade for the latest version of m365 CLI and nodejs if this is still the way to go as Adam suggested.

Thank you @Adam-it you’ve been a great help. I am definitely going to create the issues for each command suggestion, this is the least I can do 😊

running the command: m365 spo web installedlanguage list --webUrl “https://vodafoneitc.sharepoint.com/sites/testhubsite” I get the following Error: Exception of type ‘Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException’ was thrown.

@alaakh42 have you logged in to this tenant before running this command? If you run the m365 status command, what account do you see? Is it one from the same tenant as where you’re running the spo web installedlanguage get command?

Just to check, @alaakh42: is everything working as intended and we need to add the two commands for which you created an issue or do we still have an issue with retrieving the list of installed languages?

that’s cool 👍 will have a look at those when I will finish my current assignments 😉.

Both issues now raised for a New Command suggestion 2953 2954

Okay, good to know. I may go for a hybrid approach then. Do you have an idea when this extension can be applied or Where can I keep an eye on that, please?

Thank you for picking up this very quickly @Adam-it yes this is true for every hubsite I create.

yes, I will try to match the scope to yours and feedback.

Another point, getting the installed languages was a way to re-write a code snipped I wrote previously using pnp powershell

$Web = Get-PnPWeb -Includes RegionalSettings.InstalledLanguages $installedLanguages = $Web.RegionalSettings.InstalledLanguages Remove All Installed Default Languages

foreach ($Language in $installedLanguages) {
        $Web.RemoveSupportedUILanguage($Language.lcid)
    }
$Web.Update()
Invoke-PnPQuery

Set IsMultilingual to True $Web.IsMultilingual = $true Install Required Languages from Collection $languagesToInstall = ($sitesToAssociateNames | Where-Object {$_.SiteUrl -eq $site}).Language.split(";")

foreach ($language in $languagesToInstall) {
     $Web.AddSupportedUILanguage($language)
 }
 $Web.Update()
 Invoke-PnPQuery

As you can see from this code snippet, I am only trying to have some kind of control after enabling the multilingual feature on the site and only keeping the languages I need. So, if you know of a better way to achieve this using m365 CLI that would be very helpful.

@waldekmastykarz Sure, I will give it a check today. You may assign me to it