tags:

views:

540

answers:

4

I have to retrieve a list of all the share point sites to which i have access from a windows application (C#) .I am planning to use Share point web sericves but I am new to share point. Any pointer which share point web service(s) could provide me the required information.

A: 

There's no way to do this with the out of the box web services I think. You could however write your web service, deploy that to your sharepoint farm and then call that service.

In it should be a method that takes a username and then using SPSecurity.RunWithElevatedPriviliges loops through the site collections / sites to determine if the user provided has access to each.

Colin
+2  A: 

Webs.asmx should do the trick. Here's a snippet to get you started.

Dim rootNode As XmlNode = Nothing

Using ws As New WebsProxy.Webs
    ws.PreAuthenticate = True
    ws.UseDefaultCredentials = True
    ws.Url = <site collection address> + "/_vti_bin/webs.asmx"
    rootNode = ws.GetWebCollection()
End Using
Rob Windsor
+2  A: 

If you want to use the API instead then I would suggest you do the following to return all the sub webs for the current user without having to use elevated priviliges.

using(SPSite site = new SPSite("http://example/site/"))
{
    using (SPWeb web = site.OpenWeb())
    {
     SPWebCollection webCollection = web.GetSubwebsForCurrentUser();
    }
}
Michael Ciba
A: 

Looking for a similar solution, I came across SharePoint SUSHI on CodePlex. I haven't tried it yet, but it looks like it'll do what you're looking for. Or if you really want to write your own, you could check out the code and see how they're doing it.

Chad