0

I am working with sharepoint list and sharepoint client list objects. Is there any way to get web relative urls of those objects? I know about ServerRelativeUrl, DefaultViewUrl but they don't solve my problem. I want exactly web relative urls, without view url parts. For example my tasks list has a url like this

http://example.com/sites/developer/lists/tasks/CustomDefaultView.aspx

and i want only lists/tasks part. For example my shared documents has a url like this

http://example.com/sites/developer/shared%20documents/Forms/AllItems.aspx

and i want only shared%20documents part. I need this both for SPList class and for SharePoint.Client.List class thanks!

1 Answers1

3

So i found the solution. I need to use SPList.RootFolder.Url which returns Web site-relative url of the list(just what i want), and also need to do some manipulations for Client.List class as has no RootFolder.Url property, instead it has RootFolder.ServerRelativeUrl. So if i subtract the server relative url of the parent web of that list from RootFolder.ServerRelativeUrl i will get what i wanted for Client.List class.