views:

33

answers:

2

I'm trying to do something I thought would be fairly easy (as I suspect I'm not the only wanting to do this) ;

For a given user that logs into SharePoint through the web services, list all documents available (I'm interested in documents from document repositories, but anything will do at this point). I'm getting increasingly lost in all the various ways into the maze, not being able to find a simple way to just get all those documents. Is there a way to search for them all, or get all lists of repository type (and their sub-sites of that type), or is there some obvious thing I'm missing here?

I don't have any technical problems, I get the web services fine, I can use them all, traverse items found and so forth, I just don't get the correct process to get to those golden nuggets. My thinking was to use lists.asmx -> getListCollection to get the main lists, and traverse those for documents, but that's obviously not how it works. I can pull out the list of Shared Documents (root) by name, but can I get a list of all repositories for a given user?

+1  A: 

Hi,

I take it you're referring to the out of the box web services. In order to do what you require you will need to leverage the 'webs' webservice available at /_vti_bin/Webs.asmx to return details of a web and its subwebs.When you return the details of the website you are querying against, you will have a list of the Document Libraries available. Then you could call the lists service for each list on this to return your data. I suppose my main point is that you will have to traverse through all the webs and subwebs recursively.

   private void RecurseThroughWebsForDocuments(SPWeb web){
       //do whatever with documents on the web here

      foreach(SPWeb subWeb in web.Webs){     
       RecurseThroughWebsForDocuments(subWeb);
      }
}

You may be better off writing your own custom web service and deploy it on the SharePoint server. You could build a recursive method to run through sites/subsites and then list the document libraries etc. If you are dealing with a large volume of data, you could split this into multiple threads and recombine the results before you return them to speed this up.

Hope this makes sense,

Shane

Shaneo
Thanks for the reply. It's a good answer, but it's a bit fuzzy around what services called, like 1. Webs to get a list of webs, 2. then "some service" (Webs.GetAllSubWebCollection ?), 3. Lists.GetAllItems on each of the return from 2 ... Why isn't these things documented anywhere? Very frustrating.
AlexanderJohannesen
There is documentation out there its just a matter of findign the correct "sharepoint" words and terminologies.
Simon Thompson
The webservices can do everything you want no need to deploy your own web services - which would then usis the sharepoint object model which is fine but the development expleriance is rubbish as needs to be on a sharepoint server etc
Simon Thompson
Well, I'm trying to find the right words. So far I'm pulling words out of the services themselves.A comment on the documentation isn't that there *isn't* documentation, really, but it's more like they all tell you the ingredients for your cake, but very little on the baking.
AlexanderJohannesen
A: 

Not sure understand your requirements seem to mix terms. I would have a look at http://spi.codeplex.com/ its good to see the ways sharepoint is presenting the url and list names/guid's etc.

Simon Thompson
What terminology or what part is hard to understand? Thanks for the link, I'm toying with the tool now.
AlexanderJohannesen