When using the class

Microsoft.BusinessData.MetadataModel.Entity entity;

does anyone know how to get all the External Content type operation method instances so i can dynamically pass the value to the method:


Currently I have the following working but the method instance name is hardcoded.

 string readListInstanceName = "Read List";
      Microsoft.BusinessData.MetadataModel.Entity entity = clientContext.Web.GetEntity(businessDataField.EntityNamespace, businessDataField.EntityName);

      Microsoft.BusinessData.MetadataModel.LobSystem lobSystem = entity.GetLobSystem();
      Microsoft.BusinessData.MetadataModel.Collections.LobSystemInstanceCollection lobSystemInstanceCollection = lobSystem.GetLobSystemInstances();

      Microsoft.BusinessData.MetadataModel.LobSystemInstance lobSystemInstance = lobSystemInstanceCollection[0];

      Microsoft.BusinessData.MetadataModel.Collections.FilterCollection externalFiltersOnFieldCollection = entity.GetFilters(readListInstanceName);
  • Can anyone please answer this, if you found it. Thank you – user38577 Jan 12 '15 at 11:29
  • sorry but I just exposed this value in my GUI and set the value to "Read List" by default or use what was provided by user. – monkeyjumps Jan 23 '15 at 6:41

You must use these two dlls:

Microsoft.SharePoint.BusinessData.Administration.Client.dll Microsoft.Office.BusinessApplications.Diagnostics.dll

Here is the code:

AdministrationMetadataCatalog catalog = AdministrationMetadataCatalog.GetCatalog(schemaRoot.Attribute("EntityNamespace").Value);

Microsoft.SharePoint.BusinessData.Administration.Client.Entity entityTemp = catalog.GetEntity(schemaRoot.Attribute("EntityNamespace").Value, schemaRoot.Attribute("EntityName").Value);

MethodInstanceCollection col = entityTemp.MethodInstances;

foreach (MethodInstance ins in col)
  if (ins.MethodInstanceType == MethodInstanceType.Finder)
    readListInstanceName=ins.Name;   //your property which u mentioned before

//Now you can use your code

The schemaRoot property is the SchemaXml of your BCS field in the library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.