pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
417 stars 645 forks source link

Lcid property ignored when creating Communication sites with CreateSiteAsync() #1706

Open jivkopetiov opened 6 years ago

jivkopetiov commented 6 years ago

Category

[x] Bug [ ] Enhancement

Environment

[x] Office 365 / SharePoint Online [ ] SharePoint 2016 [ ] SharePoint 2013

Expected or Desired Behavior

When creating a modern communication site using the method context.CreateSiteAsync(), I would like to specify the default language of the site collection (Site Settings -> Language Settings -> Default Language).

Observed Behavior

There is an Lcid property on the class CommunicationSiteCollectionCreationInformation but it doesn't seem to do anything.

Steps to Reproduce

Below code is C# console app using nuget package SharePointPnPCoreOnline version 2.24.1803:

        var settings = new CommunicationSiteCollectionCreationInformation
        {
            Lcid = 1031,
            Description = "description",
            SiteDesign = CommunicationSiteDesign.Topic,
            Url = "https://<tenant>.sharepoint.com/sites/<site>",
            Title = "Site title"
        };
        context.CreateSiteAsync(settings).Wait();

If this is not yet supported, it would be much appreciated to understand if there is an alternative way to specify the language of the site collection regardless of the approach (powershell, REST API etc).

jivkopetiov commented 6 years ago

With below PNP powershell command result was the same: lcid parameter is ignored.

new-pnpsite -type Communicationsite -title "New Site" -Lcid 1031 -SiteDesign topic -url https://<tenant>.sharepoint.com/sites/<site>

gautamdsheth commented 6 years ago

Currently its only supported with LCID 1033. Sites in other languages are not supported yet.

Check out these links:

Multilingual-for-communication-sites

communication-site-creation

Upvote on this uservoice so that it gets more visibility in the MS backlog:

multilingual-communication-sites

jivkopetiov commented 6 years ago

OK, I upvoted but my scenario is the opposite - I want to disable the existing multilingual functionality and force the language to be English only. The language of my tenant is German and so Communication sites have their default language as German. By default all alternate languages are enabled so the top navigation menu and other elements in the site get localized into multiple languages depending on the user language - this is undesired in my case. If I disable all alternate languages, the site becomes in German only, which is also undesired.

The documentation in this page Create SharePoint Communication site using REST states: "The lcid parameter is not currently supported with this API. You can currently only create English sites." which is not quite true on my tenant - I can only create German sites.

Is there by any chance a way to change the language of the Tenant to English such that Communication sites get created in English language? This would be the ideal solution.

tomvr2610 commented 6 years ago

Any news on this?

advdberg commented 5 years ago

The default language of the root site collection is the language what is used as default language for created modern sites. Removing and recreating this classic root site collection in the preferred language is the only option. See also https://github.com/SharePoint/sp-dev-docs/issues/1665

mschaefer85 commented 5 years ago

I'm facing the same issue as tomvr2610 - but with one interesting difference: I'm an admin user on a German tenant.

Creating new communication sites via the GUI results in sites whose default language is English. Creating new communication sites via PNP results in sites whose default language is German; for example, trying New-PnpSite with the -Lcid parameter (set to Dutch) creates a German site.

umaknow-francis commented 5 years ago

@advdberg & @mschaefer85 , you nailed the pattern right. I was banging my head on the wall to understand how my base language was always French in a tenant and English in another. Thanks for that! So LCID does not do anything, but as the UI is starting to release a drop-down to choose the base language in "Create a site", this is becoming urgent to support it in PowerShell.

ghost commented 5 years ago

Exactly the point I was thinking about ... since MS added the choose language option in the GUI I would expect to be able to do the same programmatically. Is that option at the moment really still missing in CSOM C#?

silmer commented 5 years ago

In our case, applying the culture info parameter in a separate prov template helped force US-English onto a comm site: <pnp:ProvisioningTemplate (...) TemplateCultureInfo="1033">

erwinvanhunen commented 5 years ago

Notice that we added support for the Lcid parameter when creating communication sites in the October 2018 release.

advdberg commented 5 years ago

Thanks @erwinvanhunen! It's indeed fixed in version 3.3.1811.0 of the SharePointPnPPowerShellOnline module

Did a quick test: New-PnPSite -Type TeamSite -Title "AVDBTest-NL-20181112a" -Alias "AVDBTest-NL-20181112a" -Lcid 1043 Created a modern teamsite with Dutch default language on an 'English' tenant.