Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.