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!
So i found the solution. I need to use
SPList.RootFolder.Urlwhich returns Web site-relative url of the list(just what i want), and also need to do some manipulations forClient.Listclass as has noRootFolder.Urlproperty, instead it hasRootFolder.ServerRelativeUrl. So if i subtract the server relative url of the parent web of that list fromRootFolder.ServerRelativeUrli will get what i wanted forClient.Listclass.