Get contents of SharePoint document library from Client .NET application

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?  
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.