How to write multi-value metadata properties using arcobjects?

324
1
08-14-2019 04:01 AM
HagenProbsthain1
New Contributor III

Hi all,

I try to update metadata using ArcObjects. This is easy for simple properties such as "dataIdInfo/idCitation/resTitle" using IPropertySet.SetProperty(Name, Value). But I can't find any information or example, how to add values for multivalue-properties such as "dataIdInfo/themeKeys/keyword".

This works (code snippet):

...

pMetaData = pDatasetName

Dim pPropSet As IPropertySet

pPropSet = pMetaData.Metadata

pPropSet.SetProperty("dataIdInfo/idCitation/resTitle", "Test1")

pMetaData.Metadata = pPropSet

But I want to write a few tags:

dataIdInfo/themeKeys/keyword:  AAA
dataIdInfo/themeKeys/keyword:  BBB

The result of:

pPropSet.SetProperty("dataIdInfo/themeKeys/keyword", "AAA")

pPropSet.SetProperty("dataIdInfo/themeKeys/keyword", "BBB")

is this:

   Tags:

   BBB, BBB, BBB, BBB, BBB, BBB, BBB

All tags contained so far have been replaced with the last keyword (there were 7 tags before).

Also this don't work (ArgumentException):

Dim pNames(1), pValues(1) As String

pNames(0) = "dataIdInfo/searchKeys/keyword"

pNames(1) = "dataIdInfo/searchKeys/keyword"

pValues(0) = "AAA"

pValues(1) = "BBB"

pPropSet.SetProperty("dataIdInfo/searchKeys/keyword", pValues)

Or this (ArgumentException):

pPropSet.SetProperties(pNames, pValues)

How to deal with it?

0 Kudos
1 Reply
HagenProbsthain1
New Contributor III

OK, after I added the question, now I found a solution by myself.

There is a possibility to add an index to the name:

pPropSet.SetProperty("dataIdInfo/themeKeys/keyword[0]", "AAA")

pPropSet.SetProperty("dataIdInfo/themeKeys/keyword[1]", "BBB")

The result is what I want:

   Tags:
   AAA, BBB

0 Kudos