There are varieties of ways available to access a sharepoint list object model, web services, RPC, DAV. Recently gotta chance to work with Microsoft ACE OLE Db objects, while playing with the object came across a strange connection string from Connectionstrings.com which just provides a connection string for a sharepoint list.
This approach is not officially documented anywhere, I thought of giving it a shot and its working too. Here's the code to display values fetched from SharePoint list using OLE DB data reader.
string connString = "Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=2;RetrieveIds=Yes; DATABASE=http://foo/;LIST={7F72D985-5219-4E8A-AA56-C4473902A333};";
OleDbConnection conn = new OleDbConnection(connString);
conn.Open();
OleDbCommand command = new OleDbCommand("select * from States", conn);
OleDbDataReader dataReader = command.ExecuteReader();
while (dataReader.Read())
{
Console.WriteLine(dataReader["Title"]);
}
This approach is strictly for development environment ONLY.
No comments:
Post a Comment