SIGN UP MEMBER LOGIN:    
ARTICLE

Programmatically Configure the Portal Site Collection in SharePoint 2010

Posted by Vijai Anand Articles | SharePoint September 28, 2011
In this article we will be seeing how to add a site collection link to the global breadcrumb navigation (Navigate Up button ) in SharePoint 2010 using the SharePoint Object model.
Reader Level:

In this article we will be seeing how to add a site collection link to global breadcrumb navigation (Navigate Up button portal1.gif) in SharePoint 2010 using the SharePoint Object model.

Portal Site Collection:

A Portal Site Collection is used to link from one site collection to another site collection. The Portal site will be added to the Navigate Up (global breadcrumb navigation).

Programmatically Configure Portal Site Collection:

  1. Open Visual Studio 2010.
     
  2. On the File Menu, click on New and then click on Project.
     
  3. Select the Console Application template from Installed templates.
     
  4. Check whether the project is targeted to .NET Framework 3.5.
     
  5. Enter the Name for the project and then click on Ok.
     
  6. Right click on the project and then click on Properties.
     
  7. Click on Build tab, and check whether the Platform Target is selected as Any CPU.
     
  8. Add the following reference.

    i) Microsoft.SharePoint.dll
     
  9. Add the following namespace.

    i) Using Microsoft.SharePoint;
     
  10. Replace Program.cs with the following code.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint;

    namespace PortalSiteCollection
    {
        class Program
        {
            static void Main(string[] args)
            {
                using (SPSite site = new SPSite("https://serverName:1234/sites/Sample/"))
                {
                    site.PortalName = "Sample Link";
                    site.PortalUrl = "https://serverName:1236/sites/Test/";
                }
            }
        }
    }

     

  11. Build the solution.
     
  12. Hit F5.
     
  13. Go to the SharePoint 2010 site collection.
     
  14. Click on Navigate Up, you will be able to see a new link added as shown in the following.

    portal5.gif
     
  15. When you click on the Sample Link, you will be redirected to the corresponding portal site. 

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Nevron Gauge for SharePoint
Become a Sponsor