Get contents of SharePoint document library from Client .NET application

Posted on 2006-03-30
Medium Priority
Last Modified: 2010-08-05
I need to read the contents of a sharepoint document library from a client .net application.  Specifically I am using c#.  This is not a webpart.

Does anyone know how to do this?  
Question by:gillgates
1 Comment

Accepted Solution

enwhysee earned 2000 total points
ID: 16354677
If your client app is located on the same box where SharePoint is installed, you could use the SharePoint object model. For example:

using Microsoft.SharePoint;

. . .

SPSite site = new SPSite("http://url");
SPWeb web = site.OpenWeb();
SPList list = web.Lists["Shared Documents"];
foreach(SPListItem item in list.Items)
     if(item.File != null)
         byte[] fileBytes = item.File.OpenBinary());

Reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/tscSPSite_SV01013594.asp

If the client app is located on another box, you'd need to use SOAP. Browse to

http://<server-url>/_vti_bin/lists.asmx for a reference of the Lists web service that'll let you query the document library.

GetList call takes a string (the list name)
GetListItems will give you the items.

Hope this helps! Feel free to ask if you have more specific information you'd like to get about a document library.


Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Integration Management Part 2
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month17 days, 2 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question