Condividi tramite


Code Snippet: Get the RemoteSharedFileBackedMetadataCatalog on the Client

Applies to: SharePoint Server 2010

In this article
Description
Prerequisites
To use this example

Description

The following code example shows how to get the RemoteSharedFileBackedMetadataCatalog object by using the Business Data Connectivity (BDC) service Runtime object model on the client.

Prerequisites

  • Microsoft Office 2010 and Microsoft .NET Framework 3.5 installed on the client computer

  • Microsoft Visual Studio installed on the client computer

  • At least one solution deployed to the Microsoft Business Connectivity Services (BCS) Client Cache

To use this example

  1. Start Visual Studio on the client computer, and then create a new C# Microsoft Office application add-in project. Select .NET Framework 3.5 when you create the project.

  2. From the View menu, select Property Pages to bring up the project properties.

  3. On the Build tab, for the Platform target, select Any CPU.

  4. Close the project properties window.

  5. In Solution Explorer, under References, remove all project references except for System and System.Core.

  6. Add the following references to the project:

    1. Microsoft.Office.BusinessApplications.Runtime

    2. Microsoft.BusinessData

  7. Replace the existing using statements with the following statements:

    using System;
    using Microsoft.BusinessData.MetadataModel;
    using Microsoft.Office.BusinessData.MetadataModel;
    using System.Windows.Forms;
    
  8. Replace the code in the add-in’s startup event with the code listed at the end of this procedure.

  9. Save the project.

  10. 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)

IEntity