Skip to main content

Define Managed Path in SharePoint

A Managed path is a location within a web application to use for site collections,You can specify that one or more site collections exist at a specified path.

As an example, sites is the managed path in http://<site>/sites/madison. Managed paths cannot be limited for use by specific security groups, nor can they be targeted directly with audiences. They are simply a way to organize a large quantity of site collections.

SharePoint uses the managed path to determine which content database the URL a user entered is in. Every URL request that comes into your server actually looks at the URL structure, looks up the managed paths listed in Central Admin, then routes the request to the proper database to retrieve the content. Knowing this, the more managed paths you add, the slower the performance so try to keep the number at a minimum (>20).
Another reason to use managed paths is to keep structure and organization in where you place your site collections. For example, if your IT department has several divisions, and each division wants their own site collection for security and “power hungry control freakish” reasons, you would want to make a managed path called IT. You can then create a site collection under this for each division, such as:

To add a managed path by using Central Administration

Verify that the user account that is performing this task is a member of the Farm Administrators SharePoint group.

1. On the the SharePoint Central Administration website, click Application Management.
2. On the Application Management page, click Manage web applications.
3. Click the web application for which you want to manage paths.

 4. The ribbon becomes active.In the Manage group of the ribbon, click Managed Paths.
On the Define Managed Paths page, in the Add a New Path section, type the path to include.
Click Check URL to confirm the path name.


In the Type list, select either Wildcard inclusion or Explicit inclusion to identify the type of path.


Wildcard Inclusion:

The Wildcard inclusion type includes all paths that are subordinate to the specified path.

When we want to create more than one site collection under a specific managed path, we use this option. Wildcard Inclusion Managed Paths allow unlimited site collection to be created under a given URL.
In our case under HR , we can create any number of site collections.

The URL of these site collections would be as below:

http://servername:port/HR/sitecolelction1
http://servername:port/HR/sitecolelction2
http://servername:port/HR/sitecolelction3
http://servername:port/HR/sitecolelction4


Explicit Inclusion:

The Explicit inclusion type includes only the site that is indicated by the specified path. Sites subordinate to the specified path are not included.



When we are not planning to create further site collections under a specified managed path, then we use this option. Explicit Inclusion Managed paths allows in creation of only one site collection at the exact given URL.
In our case HRwould be the only site collection that can be created. SharePoint will allow creating only one site collection within this Managed Path.

The URL would be: http://servername:port/HR



5. Click Add Path.
6. When you have finished adding paths, click OK.


Key points

1. Managed Paths allow SharePoint to determine what portion of a given URL corresponds to the "site collection URL".
2. Managed Paths can be defined per web application (and cannot be defined for host header site collections)
3. Managed Paths can be "Explicit" or "Wildcard"
Explicit Managed Paths allow a single spsite to be created at exactly the given url
Wildcard Manage Paths allow unlimited spsites to be created under the given url – no spsite can be created at exactly that URL.
4. Limit your managed paths to <20 per web application


To  create either explicit or wildcard managed path programmatically.

 Following code snippets shows two different ways to create managed paths. Both ways shows different ways to access the SPWebApplication application object – using URI or SPSite to create managed path.

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace CodeSnippets
{
class Program
{
static void Main(string[] args)
{
//Retrieve the Input Arguments
string url = string.Empty;
if (args.Length > 0)
{
Console.WriteLine("Input Web App URL: " + args[0].ToString());
url = args[0].ToString();
}
else
{
url = "<a href="http://sp2013proj:4545/">http://sp2013proj:4545</a>";
}

//Create Managed Path
CreateManagedPathUsingWebAppURI(url, "HR", true);
CreateManagedPathUsingWebAppURI(url, "IT", false);
CreateManagedPathUsingSPSite(url, "ADMIN", true);
CreateManagedPathUsingSPSite(url, "SALES", false);
}

////Method 1 - Create Web App object using URI
private static void CreateManagedPathUsingWebAppURI(string webAppURL, string NewSiteCollectionName, bool isWildCardInclusion)
{
SPWebApplication spWebApp = SPWebApplication.Lookup(new Uri(webAppURL));
SPPrefixCollection prefixColl = spWebApp.Prefixes;
if (prefixColl.Contains(NewSiteCollectionName) == false)
{
if (isWildCardInclusion)
{
SPPrefix prefix = spWebApp.Prefixes.Add(NewSiteCollectionName, SPPrefixType.WildcardInclusion);
}
else
{
SPPrefix prefix = spWebApp.Prefixes.Add(NewSiteCollectionName, SPPrefixType.ExplicitInclusion);
}
}
}

//Method 2 - Reference Web App Object from SPSite
private static void CreateManagedPathUsingSPSite(string webAppURL, string NewSiteCollectionName, bool isWildCardInclusion)
{
using (SPSite spSite = new SPSite(webAppURL))
{
SPWebApplication spWebApp = spSite.WebApplication;
SPPrefixCollection prefixColl = spWebApp.Prefixes;
if (prefixColl.Contains(NewSiteCollectionName) == false)
{
if (isWildCardInclusion)
{
SPPrefix prefix = spWebApp.Prefixes.Add(NewSiteCollectionName, SPPrefixType.WildcardInclusion);
}
else
{
SPPrefix prefix = spWebApp.Prefixes.Add(NewSiteCollectionName, SPPrefixType.ExplicitInclusion);
}
spWebApp.Update(true);
}
}
}
}
}


Enjoy! :).......

Comments

Popular posts from this blog

Tab Control in Asp.Net

Scenerio: I need your help in designing tab control in   asp.net .My requirement is I need a tab control in   asp.net (C#) like  for example goto my computer ,right click c drive and select properties.we get tabs like general,security etc....... like that i need to design one tab control(no need of any rightclick) in my web page and the database table columns should come as tabs and inseide the tab data of that particular column should come.   Example:Employee master tab1:Employee name.........his name in the tab tab2:Age.............his age tab3:Address........his address   Solution:   You can do this using a simple div <style type="text/css"> .tabs         {             position: relative;             height: 20px;             margin: 0;   ...

AI and Microsoft: Revolutionizing Efficiency in Nonprofit Organizations

  How AI and Microsoft Enhance Efficiency in Nonprofit Organizations In today’s fast-paced world, nonprofit organizations face unique challenges—limited resources, increasing demands, and the constant need to do more with less. But what if technology could be the game-changer they need? In my latest research paper,  "How AI and Microsoft Enhance Efficiency in Nonprofit Organizations" , I explore how cutting-edge technologies like Artificial Intelligence (AI) and Microsoft’s innovative tools are revolutionizing the way nonprofits operate. From streamlining administrative tasks to enhancing donor engagement and optimizing resource allocation, AI and Microsoft’s solutions are empowering nonprofits to focus on what truly matters—their mission. This paper dives deep into real-world examples, practical applications, and the transformative potential of these technologies. Whether you’re a nonprofit professional, a tech enthusiast, or simply curious about the intersection of technolo...

Social tagging overview in Sharepoint 2010

A tag is a word or phrase that identifies an individual piece of information according to a set of attributes or criteria. Tags make it easy to find and share information about a specific subject or task. Social tagging helps users categorize information in ways that are meaningful to them. Social tagging can improve the quality of search results by filtering against specific tags, and it can also connect individuals who want to share information with other users who have like interests. This article describes the social tagging features in Microsoft SharePoint Server 2010. This article does not describe how to configure social tagging features. It also does not discuss how to implement social tagging features as part of an overall social media strategy for an enterprise. About using social tagging features Social tagging features help users to share information and to retrieve relevant, high-quality content more efficiently. Such sharing encourages collaboration and b...