English

How To: Programmatically modify a metadata element in ArcCatalog

Summary

This article shows how to modify a metadata element in ArcCatalog using ArcObjects.

Procedure

  1. Start ArcCatalog.
  2. Open the Visual Basic Editor.

    In ArcCatalog, select Tools > Macros > Visual Basic Editor.

  3. In the Project Explorer window, expand Normal.gxt and select ArcCatalog Objects > ThisDocument then right-click and select View Code.
    [O-Image] ArcCatalog Project Explorer
  4. Copy the following code into the code module.

    Code:
    Sub ModifyMetadata()

    Dim pGxApp As IGxApplication
    Dim pGxObj As IGxObject
    Dim pMD As IMetadata
    Dim pPS As IPropertySet

    Set pGxApp = Application
    Set pGxObj = pGxApp.SelectedObject
    Set pMD = pGxObj
    Set pPS = pMD.Metadata

    'Modify the abstract metadata element
    pPS.SetProperty "idinfo/descript/abstract", "This is a test."
    pMD.Metadata = pPS

    End Sub

  5. Close the Visual Basic Editor.
  6. Select the data set containing metadata to update.
  7. Run the code.

    A. In ArcCatalog, select Tools > Macros > Macros to display the Macros dialog box.

    B. Select a macro and click Run.