Get contents of SharePoint document library from Client .NET application

Posted on 2006-03-30
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
    LVL 6

    Accepted Solution

    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());


    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now