SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a small issue, basically i have an instance of document library / list, now, how can i get a link to that list / document library?

I'm working with sp 2007

To clarify, here is the code:

        SPDocumentLibrary library = SPContext.Current.Web.Lists[listGuid] as SPDocumentLibrary;

Now i want to redirect to that particular page .. with the document library, how do i do it programmatically?

SPUtility.Redirect(**library.Url**, SPRedirectFlags.UseSource, Context);

library.Url, should be the url of the library, how do i get the url?

share|improve this question
What you mean? On the address bar of your browser you should see the link – Salvatore Di Fazio Mar 25 '13 at 13:36
updated question with some code – Shkipper Mar 25 '13 at 13:43
up vote 1 down vote accepted

Here is one way to get it.

SPList list = web.Lists["TestList"]
string serverRelative Url = list.RootFolder.ServerRelativeUrl;

//If you need full url then you can do this. Not sure GetFullUrl is available in MOSS 2007.
string absoluteUrl = SPUtility.GetFullUrl(web.Site, serverRelativeUrl)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.