URL path length restrictions (SharePoint Server 2010)

 

Applies to: SharePoint Server 2010, SharePoint Foundation 2010

This article discusses the specific URL path length and character restrictions in Microsoft SharePoint Server 2010, Internet Explorer 7, and Internet Explorer 8 that you should be aware of when planning sites, navigation, and structure. This article does not discuss URL length limitations in other browsers. For this information, see the browser documentation.

In this article:

  • Understanding URL and path lengths

  • URL path length limitations

  • Resolving URL length problems

Understanding URL and path lengths

This section discusses URL composition, how SharePoint Server 2010 builds URLs, how URLs are encoded and lengthened, and passed as parameters in other URLs.

SharePoint URL composition

The total length of a SharePoint URL equals the length of the folder or file path, including the protocol and server name and the folder or file name, plus any parameters that are included as part of the URL. The formula is as follows:

  • URL = protocol + server name + folder or file path + folder or file name+ parameters

For example, the following is a typical URL path to a file stored in Microsoft SharePoint Server 2010:

https://www.contoso.com/sites/marketing/documents/Shared%20Documents/Promotion/Some%20File.xlsx

Where the parts of the URL path are as listed in the following table.

URL part Example

Protocol

http://

Server name

www.contoso.com/

Folder or file path

sites/marketing/documents/Shared%20Documents/Promotion/

File name

Some%20File.xlsx

When you go to the site and open the file with Microsoft Office Web Apps, the URL will be as follows:

https://www.contoso.com/sites/marketing/documents/_layouts/xlviewer.aspx?id=/sites/marketing/documents/Shared%20Documents/Promotion/Some%20File.xlsx&Source=http%3A%2F%2Fwww%2Econtoso%2Ecom%2Fsites%2Fmarketing%2Fdocuments%2FShared%2520Documents%2FForms%2FAllItems%2Easpx%3FRootFolder%3D%252Fsites%252Fmarketing%252Fdocuments%252FShared%2520Documents%252FPromotion%26FolderCTID%3D0x012000F2A09653197F4F4F919923797C42ADEC&DefaultItemOpen=1

Where the parts of the URL path are as listed in the following table.

URL part Example

Protocol

http://

Server name

www.contoso.com/

Folder or file path

sites/marketing/documents/Shared%20Documents/Promotion/

Folder or file name

xlviewer.aspx

Parameters

?id=/sites/marketing/documents/Shared%20Documents/Promotion/Some%20File.xlsx

&Source=http%3A%2F%2Fwww%2Econtoso%2Ecom%2Fsites%2Fmarketing%2Fdocuments%2FShared%2520Documents%2FForms%2FAllItems%2Easpx %3FRootFolder%3D%252Fsites%252Fmarketing%252Fdocuments%252FShared%2520Documents%252FPromotion%26FolderCTID%3D0x012000F2A09653197F4F4F919923797C42ADEC

&DefaultItemOpen=1

URL Encoding

URL encoding ensures that all browsers will correctly transmit text in URL strings. Characters such as a question marks (?), ampersands (&), slash marks (/), and spaces might be truncated or corrupted by some browsers. SharePoint Server 2010 adheres to the standards for URL encoding that are defined in The Internet Engineering Task Force (IETF) RFC 3986 (https://go.microsoft.com/fwlink/p/?LinkId=195564&clcid=0x409).

In the URL path example earlier in this article, the Source parameter contains a double-encoded path and is 262 characters. The first de-encoding reveals:

&Source=https://www.contoso.com/sites/marketing/documents/Shared%20Documents/Forms/AllItems.aspx?RootFolder=%2Fsites%2Fmarketing%2Fdocuments%2FShared%20Documents%2FPromotion&FolderCTID=0x012000F2A09653197F4F4F919923797C42ADEC which is 216 characters.

De-encoded again reveals:

&Source=https://www.contoso.com/sites/marketing/documents/Shared Documents/Forms/AllItems.aspx?RootFolder=/sites/marketing/documents/Shared Documents/Promotion&FolderCTID=0x012000F2A09653197F4F4F919923797C42ADEC which is 200 characters.

If you have non-standard ASCII characters, such as high-ASCII or double-byte Unicode characters, in the SharePoint URL, each of those characters is URL-encoded into two or more ASCII characters when they are passed to the Web browser. Thus, a URL with many high-ASCII characters or double-byte Unicode characters can become longer than the original un-encoded URL. The list below gives examples of the multiplication factors:

  • High-ASCII characters — for example, (!, ", #, $, %, &, [Space]): multiplication factor = 3

  • Double byte Unicode characters — for example, Japanese, Chinese, Korean, Hindi: multiplication factor = 9

For example, when you translate the names of sites, library, folder, and file in the URL path https://www.contoso.com/sites/marketing/documents/Shared%20Documents/Promotion/Some%20File.xlsx into Japanese, the resulted encoded URL path will become something like the following:

https://www.contoso.com/sites/%E3%83%9E%E3%83%BC%E3%82%B1%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0/%E6%96%87%E6%9B%B8/DocLib/%E3%83%97%E3%83%AD%E3%83%A2%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB.xlsx. This path is 224 characters, whereas the original URL path is only 94 characters.

Important

The following characters cannot be used in an un-encoded URL: (~, #, %, &, *, {}, , :, <>, /, +, |, “).

URL parameters

URL parameters are data that are included as part of the URL that are processed. These parameters are also URL-encoded and can be encoded multiple times, producing very long URLs.

For example, if you browse to a list, the URL might be something like the following: https://www.contoso.com/sites/marketing/documents/Shared%20Documents/Forms/AllItemA.aspx?RootFolder=%2Fsites%2Fmarketing%2Fdocuments%2FShared%20Documents%2FPFPromoti&FolderCTID=0x012000F2A09653197F4F4F919923797C42ADEC&View={CD527605-9A7A-448D-9A35-67A33EF9F766}. This URL is 260 characters.

If you then click Create View on the Library tab, the entire URL is included in the resulting URL as the source parameter and it is encoded to be much longer — for example, https://www.contoso.com/sites/marketing/documents/_layouts/ViewType.aspx?List=%7BED6E21E0%2DDF28%2D4165%2DBC3E%2D5371987CC2D2%7D&Source=http%3A%2F%2Fwww%2Econtoso%2Ecom%2Fsites%2Fmarketing%2Fdocuments%2FShared%2520Documents%2FForms%2FAllItems%2Easpx%3FRootFolder%3D%252Fsites%252Fmarketing%252Fdocuments%252FShared%2520Documents%252FPromotion%26FolderCTID%3D0x012000F2A09653197F4F4F919923797C42ADEC%26View%3D%7BCD527605%2D9A7A%2D448D%2D9A35%2D67A33EF9F766%7D. This URL is 457 characters.

Important

SharePoint Server 2010 truncates the URL source parameter if the total URL length to be passed to Internet Explorer is more than 1950 bytes. The source parameter is a reference to a previously visited page. The result of the truncation of the source parameter is that the user will be referred back to default location rather than the location specified in the source parameter.
Other parameters, such as sort orders, root folder parameters, and views are not truncated.

URL path length limitations

This section discusses the different URL length limitations in SharePoint Server 2010 and Internet Explorer, and how to plan for URL path lengths.

SharePoint URL path length limitations

The limitations In this section apply to the total length of the URL path to a folder or a file in SharePoint Server 2010 but not to the length of any parameters. Also, these limitations apply only to un-encoded URLs, not to encoded URLs. There is no limit to encoded URLs in SharePoint Server 2010. The limitations are the following:

  • 260 Unicode (UTF-16) code units – the characters in a full file path, not including a domain/server name.

  • 256 Unicode (UTF-16) code units – the characters in a full folder path, not including the file name and the domain/server name.

  • 128 Unicode (UTF-16) code units - characters in a path component, that is, a file or folder name.

  • 260 Unicode (UTF-16) code units – the characters in a full path, including a domain/server name for use with Office clients.

  • 256 Unicode (UTF-16) code units – the characters in a full path including the domain/server name, for use with Active X controls.

For more information, see Microsoft Knowledge Base article 894630, You receive a "The specified file or folder name is too long" error message (https://go.microsoft.com/fwlink/p/?LinkId=195567&clcid=0x409).

Note

Understanding code units - In most cases, one UTF-16 character equals one UTF-16 code unit. However, characters that use Unicode code points greater than U+10000 will equal two UTF-16 code units. These characters include, but are not limited to, Japanese or Chinese surrogate pair characters. If your paths include these characters, the URL length will exceed the URL length limitation with fewer than 256 or 260 characters.

Internet Explorer URL length limitations

Internet Explorer also has limitations that are separate from those in SharePoint Server 2010. Even though you make the SharePoint Server 2010 URL path shorter than the limitations, you might experience an Internet Explorer URL length limitation because of added parameters and encoding of the URL. You must use the most restrictive limitation as a guideline for planning URL lengths.

Both Internet Explorer 7 and Internet Explorer 8 have a maximum URL length of 2,083 UTF-8 characters and a maximum path length of 2,048 UTF-8 characters. However, in Internet Explorer 7, under certain circumstances, the effective URL length limitation is 1024 UTF-8 characters, not 2083 UTF-8 characters. For more information about the URL length limits in Internet Explorer, see Microsoft Knowledge Base article 208427, Maximum URL length is 2,083 characters in Internet Explorer (https://go.microsoft.com/fwlink/p/?LinkId=195568&clcid=0x409).

Important

Unless all of the browsers in the environment are Internet Explorer 8, use the effective limit of 1024 UTF-8 characters.

Resolving URL length problems

There are several ways that you can resolve or mitigate URL length problems in the SharePoint Server 2010 environment. The following list provides suggestions:

  • Upgrade all the end-user browsers to Internet Explorer 8, which has a longer URL length limit.

  • Use shorter names for sites, folders, and documents and control the depth of the site and folder structures to reduce the lengths of URLs.

  • If possible or allowed, use ASCII names for sites, folders, and documents. This will avoid situations where the URL will be lengthened by being encoded.

  • To reduce the risk that the SharePoint Server 2010 end-users will encounter problems because of URL length limitations, we recommend that you apply the following effective limits in the deployment:

    • 256 Unicode (UTF-16) Code units - the effective file path length limitation, including a domain/server name

    • 128 Unicode (UTF-16) Code units - the path component length limitation