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?

  • What you mean? On the address bar of your browser you should see the link Mar 25, 2013 at 13:36
  • updated question with some code
    – Shkipper
    Mar 25, 2013 at 13:43

1 Answer 1


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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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