Hi, I'd love to be able to access a SharePoint list directly in SQL Server. I know I'm not the only one. I'm ever so close but still not quite there.
I've added a linked server to my SharePoint list: the following code uses the Office 2007 data access driver. Nice.
The linked Server connection tests out Ok in Test Connection. However if I try and query it I get errors (see below). I think the problem is that the linked server is unable to discover any tables in the data source. Please help. Thanks.
Here's the code I used to add the server. Note the Datasrc is the sharepoint site and LIST is the list GUID. Everything else should be identical.
--add link server
exec sp_addlinkedserver
@server='LinkToSharePoint',
@srvproduct='ACE 12.0',
@datasrc='http://demoserver/Lists/',
@provstr='WSS;IMEX=2;RetrieveIds=Yes;LIST={F4170755-BC3A-466D-9303-3B55B11289E6};'
GO
SELECT * From LinkToSharePoint...list
returns:
"The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "LinkToSharePoint" does not contain the table "list". The table either does not exist or the current user does not have permissions on that table."
SELECT * FROM OPENQUERY(LinkToSharePoint, 'SELECT * From jasons')
returns:
"Cannot process the object "SELECT * From jasons". The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "LinkToSharePoint" indicates that either the object has no columns or the current user does not have permissions on that object."
Thanks. If you can solve this you're a genius.