Friday, June 6, 2014

ECMA2 schema and multi-valued attributes

Hello all,

I've been working with ECMA2s recently and I've just started to need a multi-valued attribute as part of the object schema.

Working with this, I had a problem trying to populate this attribute during an Import run.

Typically dealing with multi-valued attributes strategies in the past involves iterating through each value using a For Each... loop or something similar.  The issue I was running into was how to designate the index on the multi-valued attribute.  I couldn't find much on the web either.

For ECMA2 schemas I figured out an easy to populate the attribute. Place the value(s) in a List (of Object) type then you can populate the multi-valued attribute with the List.

Here's a little code showing what I mean:

Dim groups As List(Of Object) = New List(Of Object)

'populate groups with values as needed

newCsentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd("groupName", groups))

Hope this helps.
-Peter