Sometimes it happens that SharePoint provides exceptionally long addresses for pages. If it also happens to be that when adding such a long hyperlink to the Quick Launch, that the link will exceed the 255 character limit to addresses in the Quick Launch. This post addresses strategies to shorten long SharePoint URLs into something a little more manageable.

Take, for example, a typical link to the NewForm.aspx file we get when clicking New Item on a list or document library (shown on multiple lines for convenience):

http://share.demo.com/sites/ExampleSPSiteDemo/Lists/Document%20LibExamples/NewForm.aspx?RootFolder=%2Fsites%2FExampleSPSiteDemo%2FLists%2FDocument%20LibExamples&Source=http%3A%2F%2Fshare%2Edemo%2Ecom%2Fsites%2FExampleSPSiteDemo%2FLists%2FDocument%2520LibExamples%2FAllItems%2Easpx

This obscenely long URL winds up getting truncated when typed or pasted into the quick launch, turning out like:

http://share.demo.com/sites/ExampleSPSiteDemo/Lists/Document%20LibExamples/NewForm.aspx?RootFolder=%2Fsites%2FExampleSPSiteDemo%2FLists%2FDocument%20LibExamples&Source=http%3A%2F%2Fshare%2Edemo%2Ecom%2Fsites%2FExampleSPSiteDemo%2FLists%2FDocument%2520LibE

Oftentimes, an adequate solution is to trim the unwanted muck from the address. Here are some ideas:

  1. Remove the protocol (http://) and host name (share.demo.com) from the URL. The result is an address that starts with a slash (/) and, as a side benefit, improves your administrator's ability to do some maintenance tasks.
    • In this case, removing the protocol and host saves us 21 characters, which is enough to solve the problem at hand, but might be inadequate to completely solve the problem with exceptionally long addresses.
  2. Remove unwanted query string values. The query string is everything after the question mark (?). Query strings are usually formatted like ?key1=value1&key2=value2&key3=value3&..., where each of the values might appear to be gibberish. In the case of the address above, there are two keys: RootFolder, and Source.
    • RootFolder determines which folder will receive the new item. If your list does not use folders, feel free to strip out everything from the word RootFolder to the next ampersand (&).
    • Source determines where the browser should go after the item is inserted. The default source is the default view of the list or library. If redirecting to the default view is not inappropriate, strip out the Source key and value.
    • If you strip out all the keys and values, you can delete the question mark as well.

Supposing you do all the suggested reductions, the URL now looks like this:

/sites/ExampleSPSiteDemo/Lists/Document%20LibExamples/NewForm.aspx

...Which is well under the 255 character Quick Launch limit, and is easier for a real human to digest, anyway.


 
Categories: SharePoint