I need to retrieve the items of BCS based list.
I am using the server side object model on SP2013 and I am getting this error:
An error occurred while enumerating through a collection: The shim execution failed unexpectedly – Could not load file or assembly ‘System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)
I am running this code from a console application:
using (SPSite site = new SPSite("http://mysiteUrl")) { var context = SPServiceContext.GetContext(site); using (var scope = new SPServiceContextScope(context)) { SPWeb web = site.OpenWeb(); using (web) { SPList myList = web.Lists["BCS List"]; var items = (from SPListItem item in myList.Items where Convert.ToString(item["MyField"]) == "myValue" select item).ToList(); } } } The problem is on the .Items attribute.