In The Mix

As a SharePoint architect I have the business behind me and the Developers and IT Pro on my shoulders.

Tiny URL in SharePoint May 12, 2008

Filed under: SharePoint — fmuntean @ 6:11 am

If you have converted some or all of your organization’s paper forms into SharePoint forms (i.e. not an InfoPath form but the data entry form that is generated by a SharePoint list or library), there may be times when you want to link to one of these from a SharePoint links list.  For example, a popularly-used form like a time-off request or help desk ticket could have a link on your portal’s home page. 

The problem is that the URL for a SharePoint form is very long, and can surpass the character-length limit in the URL field of a Links list.  We have seen a consistent issue where linking to a form from a cut-off URL  will take the user to the desired form, but then produce a page error when they click OK or Cancel.

The simple workaround is to link to the list itself and teach the users to click the New button; however this isn’t the most user-friendly option.  You could try creating a smaller link at www.tinyurl.com, but this won’t work well if the link is for an https:// environment. 

If you have access to IIS then there is an easy way to create your own Tiny URLs as you like, plus they will work over https.

How? You would configure the IIS virtual server for the SharePoint Web Application  and create virtual directories with redirection.  

For example, you create a Virtual directory named TinyURL to store all the virtual directories used for TinyURL in your application. Under this you will start creating virtual directories with redirection to the long and complex URL inside SharePoint. Now instead of using the long URL you can type just the short one, e.g.  https://sharepoint/TinyUrl/Link1  

Detailed steps:

1. On your SharePoint web server, open IIS.

2. Expand to the current web site.

3. Right-click the current web site and choose New -> Virtual Directory

4. The wizard will pop up; click Next

5. In the Alias field, type your desired name (e.g. TinyUrl), and click Next

6. In the Path field, you need to choose an empty directory.   You can create this anywhere, but I recommend the path:

[drive]\InetPub\wwwroot\wss\virtualdirectories\[your site]\ – browse to this, click Make New Folder, then enter [your desired folder name]

7. Click OK, then click Next

8. Accept the default permission, Read, and click Next, then Finish.

9. This creates the root folder for your tiny URLs.

Now we can add the URLs.

10. On the TinyURL virtual folder you just created, right-click and choose New -> Virtual Directory.  Follow the steps shown above to go through the wizard; this time for the alias field enter your first link name (i.e. Link1) and the same path as before.  We will create the redirection in the next step.

11. After you click Finish, right-click on the folder name you just created (Link1), and choose Properties.

12. Choose “A redirection to a URL,” enter your very long link name in the Redirect to: field, and then select “A permanent redirection for this resource,” as shown below:

tinyurl1

 

Note: If you have multiple Web Front End Servers in your farm you will need to configure this for all of them and all the settings need to match.

Another approach would be to create a custom http module for the redirection and deploy this as a solution, but it will require code.

 

For people with a MOSS and publishing enabled there is a page named RedirectPage.aspx that can be created inside a page library.  This can only be used for one URL per page, and the end-user has to visit the page in order to see the redirect link.  This would be useful at times when you want the user to be aware of the redirection, for example from a discontinued website to a newly-released replacement.

Advertisements
 

16 Responses to “Tiny URL in SharePoint”

  1. Bebyviepe Says:

    FANTASTIC!

  2. If you ever want to hear a reader’s feedback 🙂 , I rate this post for 4/5. Detailed info, but I have to go to that damn google to find the missed parts. Thank you, anyway!

  3. fmuntean Says:

    Hi,

    I always like to hear a constructive feedback. If you think that are missing pieces please provide them in a comment so others can benefit from it and I can see what I need to improve too.

  4. Geoff Says:

    A point worth mentioning with this strategy is that if you are going to go this route, you should make sure you are backing up your IIS configuration. Since SharePoint stores everything in the databases, it could be easy for someone to not think about the fact they now have this aspect of their solution that is not in the database and needs to be backed up separately.

  5. fmuntean Says:

    Good point,
    When you make a change or install something on top of sharepoint you know what it takes to backup and restore it.

  6. Chris Says:

    While this is an interesting approach, this still requires more interaction from the administrator. In a large environment, that makes this approach impractical.

    Great idea and thanks for the tip!

  7. That is an interesting approach that I had not thought about before.

    You can also use an add-in that does all the work for you and can be used by ‘regular’ end users who do not have access to the server.

    http://www.muhimbi.com/Products/SharePoint-URL-Shortener.aspx

    Full disclosure, I worked on this product and obviously think it is fantastic 😉

  8. Jason Barron Says:

    Excellent article.

    I’ve recently released the SharePoint URL Redirector for free on CodePlex. It can solve the problem you speak of and provide some additional benefits such as deep URL translation (provide a tiny URL for an entire site full of content for example).

    Check out my company’s blog here for more info and a link to the CodePlex site: http://rdacollab.blogspot.com/2009/06/sharepoint-url-redirector-available-for.html

  9. Paul Leigh Says:

    We launched a product to do this recently too. http://sharepointshorturl.com/

  10. cRiley SLOAN Says:

    Just testing everything out!

  11. Terence Dolton Says:

    great sharing. thanks a lot

  12. Jessica Kingston Says:

    I’m impressed!! Actually informative weblog post here my good friend. I just needed to comment & say keep up the quality work. I’ve bookmarked your weblog just now and I’ll be back to read more in the future my buddy! Also nice colors on the layout, it’s definitely easy on the eyes.

  13. You completed various nice points there. I did a search on the matter and found mainly people will go along with with your blog.

  14. Nice post about Tiny URL in SharePoint « In The Mix. I am very impressed with the time and effort you have put into writing this story. I will give you a link on my social media blog. All the best!

  15. Hello! I just want to give you a huge thumbs up for your excellent information you’ve got right here on this post.
    I will be returning to your site for more soon.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s