none
In O365, how to show the list from root level site in all sub sits(1500 sub level sites)? RRS feed

  • Question

  • HI 

    I have a solution in SP2010,There i have an Custom template.If i create template based on custom,custom list is created in newly created sites (using site definition through SOM Code).

    Samething i have to develop in O365. If not atleast show the parent level lists show in all sub sites with out create again and again.

    Let me know the solution how to solve this problem?

    Tuesday, November 7, 2017 1:33 PM

All replies


  • hi, I just checked in Sharepoint Online that when you save custom list as template (List settings > Save list as template) it become available in all sub sites of the current site collection, i.e. when you go to some sub site and click Add new app you will see your custom list template here and will be able to create new lists based on it. List template itself is saved into List templates gallery https://example.sharepoint.com/sites/siteA/_catalogs/lt (where instead of https://example.sharepoint.com/sites/siteA you should put your site collection). Each site collection has own List templates gallery which means that list template saved in one site collection won't be available in other site collection: in our example list template from https://example.sharepoint.com/sites/siteA won't be available on https://example.sharepoint.com/sites/siteB. If you want to make it available on other site collections you will need to copy list templates into their List templates galleries. But again within https://example.sharepoint.com/sites/siteA list template is available on all sub sites.

    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - https://github.com/sadomovalex/camlex

    Tuesday, November 7, 2017 3:23 PM
  • Hi,

    A workaround is to create the list with custom template for all sub site using SharePoint Online PowerShell command:

    $clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url) 
    $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword) 
    $clientContext.Credentials = $credentials 
    
    if (!$clientContext.ServerObjectIsNull.Value) 
    { 
        Write-Host "Connected to SharePoint Online site: '$Url'" -ForegroundColor Green 
    } 
    $web = $clientContext.Web
      $clientContext.Load($web)
      $clientContext.Load($web.Webs)
      $context.ExecuteQuery()
    $templates = $clientContext.Site.GetCustomListTemplates($web)
    $clientContext.Load($templates)
    $clientContext.ExecuteQuery()
    
    $template = $templates | Where-Object{ $_.Name -eq "SomeTemplate" }
        foreach($sub in $web.Webs)
      {
     
            $lci = New-Object Microsoft.SharePoint.Client.ListCreationInformation
            $lci.Title = "New List"
            $lci.TemplateFeatureId = $template.FeatureId
            $lci.TemplateType = $template.ListTemplateTypeKind
            $lci.ListTemplate  = $template
            
            $lists = $sub.Lists;
            $clientContext.Load($lists);
            $clientContext.ExecuteQuery();
    
            $list = $lists.Add($lci)
            $list.Update()
            $clientContext.ExecuteQuery()
    }

    Thanks

    Best Regards


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

    Wednesday, November 8, 2017 10:21 AM