Reputation: 507
I have an url what points a SharePoint element. I do not know the type of the element it can be a list, a document library, an element in these or just a site url. I can only use the Web Services of SharePoint. I have to decide the type of it.
I found a solution: the GetUrlSegments WS can give this information but it can work if I call the WS at the subsite where the element is in. A know just the url I don not know what part of the url is the site url.
How can I decide of the type of the element from an url?
Or how can I decide url of the site (or subsite) from an url?
Upvotes: 2
Views: 159
Reputation: 507
I have found the answer. It is not so simple but usable.
If the GetURLSegments returns nothing: The url points to a site.
If the GetURLSegments returns only listId: The url points to a list. With the lists.asmx.GetList you can get information from the list.
If the GetURLSegments returns with listId and itemId: The url points to a list item. With the lists.asmx.GetListItems you can get information from the item.
Upvotes: 1