SharePoint 2013 server, I'm site collection administrator.
I've copied an Excel file into documentlibrary, I like to read the excel file and update custom list with the Excel values.
I've got the connnectionstring from: https://www.connectionstrings.com/sharepoint/
When I do con.Open()
I get permission error. The Visual Webpart is a sandbox solution and I try to read in the same site...
string Connection = "Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=2;RetrieveIds=Yes;DATABASE=http://sharepoint/scp/Files/;LIST={6400FE4B-1681-46DE-9CDF-4DDACE38032A}";
OleDbConnection con = new OleDbConnection(Connection);
con.Open();
DataTable sheetsName = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" });
foreach (DataRow rSheet in sheetsName.Rows)
I receive the following error:
{"Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
A first chance exception of type 'System.Security.SecurityException' occurred in System.Data.dll
Additional information: Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Please advice how can I read Excel file in a sandboxed solution