Geeks With Blogs
Wayne Magnum's Blog
The below code snippet allows for access BCS data via C#

SPFarm farm = SPFarm.Local;
SPServiceProxyCollection spc = farm.ServiceProxies;
BdcServiceApplicationProxy sap = (BdcServiceApplicationProxy)(
                (from sp in spc 
                 where sp.TypeName.Equals("Business Data Connectivity Service")
                 select sp).First().ApplicationProxies.First());
DatabaseBackedMetadataCatalog catalog = sap.GetDatabaseBackedMetadataCatalog();

 IEntity ect = catalog.GetEntity("WPI.SharePoint.ITPMO.Data.BCS.Planview.ProjectData_Model", "ProjectDataEntity");
ILobSystem lob = ect.GetLobSystem();
ILobSystemInstance lobi = lob.GetLobSystemInstances()["ProjectData_Model"];
IFilterCollection filter = ect.GetDefaultFinderFilters();
IEntityInstanceEnumerator ects = ect.FindFiltered(filter, lobi);
while (ects.MoveNext())
Posted on Tuesday, January 22, 2013 1:31 PM SharePoint 2010 | Back to top

Comments on this post: Access BCS Data via C#

# re: Access BCS Data via C#
Requesting Gravatar...
Good article. What I was searching for.
Left by Abbas on Apr 11, 2013 1:03 AM

Your comment:
 (will show your gravatar)

Copyright © Wayne H Magnum | Powered by: