none
What should i pass for the LocalID when creating a new subsite using SPWeb.Webs.ADD() RRS feed

  • Question

  • I am working on a sharepoint server 2013. and i have created an event receiver which get fired when an item is updated.

    now inside the event receiver i want to create a new sub-site as follow:-

    SPWeb newSite = spCurrentSite.Webs.Add(
                     curItemID, 
                     curItemSiteName,
                     "created automatically after adding a new project item",
                     Convert.ToUInt16(1033),
                     webTemplate,
                     false,
                     false
    );
    newSite.Update();

    and one confusing parameter is the LocalID i need to pass. so i am not sure which value i need to pass? now inside the above example i am passing 1033, but our customer is a UK-based company so should i be passing local ID = 2057 instead?

    now i did the following experiments to try to understand our current local ID:-

    1. i run this power-shell script to get the localID for one of our sharepoint sites:-

    $SiteUrl = "http://servername/sites/HR/subsiteA/"
    $site = Get-SPWeb $SiteUrl
    write-host $site.Language
    $site.Dispose()
    
    

    I will get 1033

    2. i run these 2 power-shell scripts (Get-UICulture & Get-Host) to get the local for our on-premise windows server:-

    PS C:\Windows\system32> Get-UICulture
    
    LCID             Name             DisplayName
    ----             ----             -----------
    1033             en-US            English (United States)
    
    
    PS C:\Windows\system32> Get-Host
    
    
    Name             : ConsoleHost
    Version          : 3.0
    InstanceId       : **********************************
    UI               : System.Management.Automation.Internal.Host.InternalHostUserI
                       nterface
    CurrentCulture   : en-GB
    CurrentUICulture : en-US
    PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
    IsRunspacePushed : False
    Runspace         : System.Management.Automation.Runspaces.LocalRunspace

    3. i went to "Central Admin" >> "Upgrade and Migration" >> "check product and patch installation status", i got three rows mentioned that the language is 1033:-

    so i am confused on these:-

    1. can i set my sub-site inside the above code to be 2057 instead of 1033 since our customer is a UK-Based ? or sharepoint does not support having localId=2057 for a site collection or for a sub-site?

    2. Am I having any problem that i am using local=1033 ,, although the company culther such as date format and other regional setting is a UK based not US based ? as seems inside sharepoint if a site collection localID=1033 i can still set its regional settings as UK ..

    Tuesday, January 10, 2017 6:28 PM

Answers

  • Hi John,

    Please use 1033 to create your sub site, then go to site settings-> Regional Settings, and change the Locale to "English(United Kingdom)".

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by johnjohn11 Sunday, January 15, 2017 1:44 AM
    Friday, January 13, 2017 2:17 AM
    Moderator

All replies

  • Hi

    localId is not for language, you should set the language. since you are in on premise environment, you need to install the specific language pack.

    the localId is stand for the date and time string format in different countries.


    顺其自然地勇往直前!—Justin Liu

    Wednesday, January 11, 2017 12:15 AM
  • Hi

    localId is not for language, you should set the language. since you are in on premise environment, you need to install the specific language pack.

    the localId is stand for the date and time string format in different countries.


    顺其自然地勇往直前!—Justin Liu

    thanks for the reply.

    so just to make sure i got your point correctly. now when creating the new sub-site using SPSite,Webs.ADD() as follow:-

    SPWeb newSite = spCurrentSite.Webs.Add(
                     curItemID, 
                     curItemSiteName,
                     "created automatically after adding a new project item",
                     Convert.ToUInt16(1033),
                     webTemplate,
                     false,
                     false
    );
    newSite.Update();

    then the 4th parameter represents the language ID and not the localID?

    second question. If the answer for the first question is that i need to pass the language ID. Then since i want my sub-site to be English then  i should pass 1033 as i am currently doing. as for English language (regardless of being UK or US ) then the languaeID will always be 1033 as mentioned on this link https://msdn.microsoft.com/en-us/library/office/ms412285.aspx regardless if i need US or UK English  ?? is this correct ? as the language pack for sharepoint 2013 does not have two IDs for English (as in the local ID case),, it only have English with 1033 ID ,, is this correct ?

    Wednesday, January 11, 2017 12:25 AM
  • I should say, Yes. But the language property is represented to LCID.

    https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.webcreationinformation.language.aspx?f=255&MSPPError=-2147217396

    So your understanding is also correct. :)

    I think you just pass 1033 is ok.

    Like I said above, there is another setting called localeid in web.RegionalSettings.LocaleId, which represents to date and time format.


    顺其自然地勇往直前!—Justin Liu

    Wednesday, January 11, 2017 1:03 AM
  • I should say, Yes. But the language property is represented to LCID.

    https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.webcreationinformation.language.aspx?f=255&MSPPError=-2147217396

    So your understanding is also correct. :)

    I think you just pass 1033 is ok.

    Like I said above, there is another setting called localeid in web.RegionalSettings.LocaleId, which represents to date and time format.


    顺其自然地勇往直前!—Justin Liu

    >>I think you just pass 1033 is ok.

    so for English LanguaeID i need to use 1033 . and this covers UK,US, etc.. so there is not a LanguageID =1057 for English(UK) is this correct? i based my assumption on this link https://technet.microsoft.com/en-us/library/ff463597.aspx?f=255&MSPPError=-2147217396 where it mentioned only one ID for English language.

    >>Like I said above, there is another setting called localeid in web.RegionalSettings.LocaleId, which represents to date and time format.

    yes i know about the Regional Settings, and this can be changed later on from "site settings >> Regional Settings".. but inside the SPWeb.ADD() i can not pass the regional settings? is this correct ?

    Third question. now inside this MSDN link :-

    https://msdn.microsoft.com/en-us/library/office/ms412285.aspx

    they mentioned that we need to pass the nLCID , but in the description they mentioned "An unsigned 32-bit integer that specifies the locale ID." should they have used this description instead "An unsigned 32-bit integer that specifies the language ID." ??

    Can you please advice on my above 3 question separately -if you can-

    Thanks



    • Edited by johnjohn11 Wednesday, January 11, 2017 1:29 AM
    Wednesday, January 11, 2017 1:26 AM
  • Hi,

    The LocaleID is the locale identifier (LCID) for the installation.

    https://msdn.microsoft.com/en-us/library/office/ms448720%28v=office.14%29.aspx?f=255&MSPPError=-2147217396

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com


    Wednesday, January 11, 2017 8:56 AM
    Moderator

  • If you want to use 2057, please install the language pack for your server.

    https://technet.microsoft.com/en-us/library/cc262108.aspx

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    But i am no sure if there is really a language pack for 2057. Because based on this table link when it comes to English language packs for sharepoint 2013, then English (regardless of being UK,US) will be represented by 1033 .. is this correct?
    Wednesday, January 11, 2017 11:23 AM
  • Hi

    I suggest you just take a test.

    what happened if you pass 2057?

    I search on the internet and found there may not 2057 language pack for SharePoint.

    http://www.astaticstate.com/2009/10/sharepoint-gb-2057-localization.html


    顺其自然地勇往直前!—Justin Liu

    Thursday, January 12, 2017 12:44 AM
  • Hi John,

    Please use 1033 to create your sub site, then go to site settings-> Regional Settings, and change the Locale to "English(United Kingdom)".

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by johnjohn11 Sunday, January 15, 2017 1:44 AM
    Friday, January 13, 2017 2:17 AM
    Moderator