Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8415077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:20:34+00:00 2026-06-10T01:20:34+00:00

I have custom sharepoint site xml template. sharepoint when i am creating custom site

  • 0

I have custom sharepoint site xml template.

sharepoint when i am creating custom site based on my site template.
Features included:

 <Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
      <!-- Publishing -->
      <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
        <!--<Property Key="ChromeMasterUrl" Value="~SiteCollection/_catalogs/masterpage/my.master" />-->
        <Property Key="WelcomePageUrl" Value="$Resources:osrvcore,List_Pages_UrlName;/default.aspx" />
        <Property Key="PagesListUrl" Value="" />
        <Property Key="SimplePublishing" Value="true" />
        <!--<Property Key="DefaultPageLayout" Value="~SiteCollection/_catalogs/masterpage/my.aspx"/>-->
        <Property Key="EnableApprovalWorkflowOnDocuments" Value="false"/>
        <Property Key="EnableApprovalWorkflowOnImages" Value="false"/>
        <Property Key="EnableApprovalWorkflowOnPages" Value="false"/>
        <Property Key="EnableModerationOnDocuments" Value="false"/>
        <Property Key="EnableModerationOnImages" Value="false"/>
        <Property Key="EnableModerationOnPages" Value="true"/>
        <Property Key="EnableSchedulingOnDocuments" Value="false"/>
        <Property Key="EnableSchedulingOnImages" Value="false"/>
        <Property Key="EnableSchedulingOnPages" Value="true"/>
        <Property Key="RequireCheckoutOnDocuments" Value="false"/>
        <Property Key="RequireCheckoutOnImages" Value="false"/>
        <Property Key="RequireCheckoutOnPages" Value="false"/>
        <Property Key="VersioningOnPages" Value="MajorAndMinor"/>
      </Properties>
    </Feature>

    <Feature ID="541F5F57-C847-4e16-B59A-B31E90E6F9EA">
      <!-- Per-Web Portal Navigation Properties-->
      <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
        <Property Key="InheritGlobalNavigation" Value="false"/>
        <Property Key="IncludeSubSites" Value="false"/>
        <Property Key="IncludePages" Value="false"/>
      </Properties>
    </Feature>

And i have feature where i am trying to add nodes:

   private void ProvisionQuickLaunchLinks(SPWeb web)
    {
        var serverUrl = web.ServerRelativeUrl;
        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            using (SPSite impSite = new SPSite(web.Site.ID))
            {
                RemoveExistingNodes(web, impSite);

                using (SPWeb impWeb = impSite.OpenWeb(web.ID))
                {
                    if (impWeb != null && impWeb.Exists)
                    {
                        try
                        {
                            var isRoot = SiteHelper.GetIsProjectRootSite(web);
                            impWeb.AllowUnsafeUpdates = true;

                           AddQuickLink(impWeb, "My link", "/Lists/MyList/Forms/AllItems.aspx", Constants.Navigation.NavigationLinkKey, "/_layouts/temp/temp/img/menu_icon3.png");
                            impWeb.Update();
                        }

                        catch (Exception ex)
                        {
                            LoggingService.WriteError(ex, "Cannot remove links to navigation menu");
                        }
                        finally
                        {
                            if (impWeb != null)
                            {
                                impWeb.AllowUnsafeUpdates = false;
                            }
                        }
                    }
                }
            }
        });
    }

Before add i am removing everything:

private static void RemoveExistingNodes(SPWeb web, SPSite impSite)
    {
        using (SPWeb impWeb = impSite.OpenWeb(web.ID))
        {
            if (impWeb != null && impWeb.Exists)
            {
                try
                {
                    var isRoot = SiteHelper.GetIsProjectRootSite(web);
                    impWeb.AllowUnsafeUpdates = true;

                    var quicklaunchCollection = impWeb.Navigation.QuickLaunch;
                    foreach (SPNavigationNode tempNode in quicklaunchCollection)
                    {
                        impWeb.Navigation.QuickLaunch.Delete(tempNode);
                        impWeb.Update();
                    }
                }
                catch (Exception ex)
                {
                    LoggingService.WriteError(ex, "Cannot remove links to navigation menu");
                }
                finally
                {
                    if (impWeb != null)
                    {
                        impWeb.AllowUnsafeUpdates = false;
                    }
                }
            }
        }
    }

Problem that after site is created i have not only my link but also “Sites” and “Lists”!
But i dont want to have those! Please advice how to remove them!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:20:36+00:00Added an answer on June 10, 2026 at 1:20 am

    the foreach loop is buggy. Use:

      for(int i = quicklaunchCollection.Count - 1; i >= 0; i--)
      {
         quicklaunchCollection[i].Delete();
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have SharePoint site with publishing features enabled. I have a custom content type
I have defined a custom list template type for SharePoint . I install it
I have created a custom list as a feature in sharepoint. i need to
We have a sharepoint based application that uses a custom database for storing metadata/files
I have a 2007 SharePoint site called Beta. On Beta, I have a custom
I have a Custom Action on the Site Settings page of my SharePoint site
I have a custom site definition, in an ONET.XML file. Can I get the
I have FBA sharepoint site with custom login code (see below). When the user
I need to implement a SSO between a SharePoint site and a custom PHP-based
I have a custom Sharepoint 2010 Web Template and I would like to set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.