开发者

How to pull all available documents out of SharePoint (2007) through web services?

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开发者_如何学Python Shared Documents (root) by name, but can I get a list of all repositories for a given user?


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜