Code Snippet: Enumerate External Content Types in the Client Cache
Applies to: SharePoint Server 2010
In this article
Description
Prerequisites
To use this example
Description
The following code example shows how to access the client cache and enumerate the external content types in the cache.
Prerequisites
Microsoft Office 2010 and Microsoft .NET Framework 3.5 on the client computer.
Microsoft Visual Studio.
At least one solution deployed to the BCS client cache.
To use this example
Start Visual Studio on the client computer and create a C# Office application add-in project. Select .NET Framework 3.5 when you create the project.
From the View menu, click Property Pages to bring up the project properties.
In the Build tab, for the Platform target, select Any CPU.
Close the project properties window.
In Solution Explorer, under References, remove all project references except for System and System.Core.
Add the following references to the project:
Microsoft.Office.BusinessApplications.Runtime
Microsoft.BusinessData
Replace the existing using statements with the following statements.
using System; using Microsoft.BusinessData.MetadataModel; using Microsoft.Office.BusinessData.MetadataModel; using System.Windows.Forms;
Replace the code in addin's startup event with the code listed at the end of this procedure.
Replace the values of solutionId, entityNameSpace, entityName, and lsiName with valid values.
Save the project.
Compile and run the project.
RemoteSharedFileBackedMetadataCatalog RemoteCatalog = new RemoteSharedFileBackedMetadataCatalog();
foreach (IEntity entity in RemoteCatalog.GetEntities("*"))
{
MessageBox.Show(entity.Name);
}
See Also
Reference
RemoteSharedFileBackedMetadataCatalog
GetEntities(String)