SBurris
SBurris

Reputation: 7448

Using SharePoint as a data source

I would like to create a C# ASP.Net application and query (read-on) information from our companies SharePoint site. Is this possible and if so how?

Upvotes: 5

Views: 6821

Answers (6)

Sheldon Hage
Sheldon Hage

Reputation: 424

The question asked is a good one. However the answers are now obsolete.

There are new ways to do what you are asking:

  1. SharePoint 2010 now natively supports CRUD operations over out-of-box REST interface
  2. ADO.NET Data Services can be used against the REST endpoint and then LINQ queries are possible.
  3. jQuery can also perform CRUD operations against the service if you want a client-only ASP.NET application to do the work (ala no service layer).
  4. Using Microsoft.SharePoint.Linq (and SPMetal to gen an entity model from a SP site) one can also go that route.

There is also a client object model.

Result sets can be in the form of XML, JSON, or AtomFeed

Check out these links for code details:

http://mydevexperience.wordpress.com/2011/06/25/how-to-query-sharepoint-data-source-using-ado-net-data-services/

http://mydevexperience.wordpress.com/2011/05/11/sharepoint-list-access-part-iii-how-to-access-sharepoint-windows-communication-foundation-wcf-rest-representational-state-transfer-services-using-jquery-entirely-client-side-only/

Upvotes: 2

Cody C
Cody C

Reputation: 4807

Probably want to use the Lists.asmx service. From my memory, you should be able to reference the sharepoint services by http:///_vti_bin/Lists.asmx. There are services for data access, site/page management, security, etc..

As a default, If you have a list on a page called HR on a server called MyServer, it would be http://MyServer/HR/_vti_bin/Lists.asmx. Each new site will have these web services automatically created.

You can also reference the SAMS book "Microsoft Sharepoint 2007 Development". I used that for previous projects and it help.

Upvotes: 2

Nicolas De Irisarri
Nicolas De Irisarri

Reputation: 1077

I agree with Rex M. Also you can help yourself with Linq to SharePoint in order to biuild and run the query It lets you connect via WS or the Object model as well, so you can use it inside or outside the WSS server.

Upvotes: 1

Wyatt Barnett
Wyatt Barnett

Reputation: 15673

So who is going to mention the obtuse XML these services pass back?

Upvotes: 0

Kirk Liemohn
Kirk Liemohn

Reputation: 7933

Lists.asmx is probably your best bet. If you are certain your ASP.NET website will live on the same server as SharePoint you could use the SharePoint object model.

Note that SharePoint lists are not the same as database tables. Things like foreign key constraints, unique keys, etc. are not as robust in SharePoint.

SharePoint lists provide a lot of value, but that also has a cost in the things above plus also in performance.

Upvotes: 2

Rex M
Rex M

Reputation: 144122

The best way for a standalone application to read data from a Sharepoint site from outside the farm is through Sharepoint Web Services. That page has a high-level summary of what services are available and what each one does. In Visual Studio, you can connect to these by creating Web References to the desired services in your application.

Upvotes: 9

Related Questions