Below is the example of using the SetRdsElements operation to insert a new element into an MDM dictionary. The new element is added to the root of the elements tree. To insert an element, specify the tArg.op and tArg.data fields. The tArg.data property contains element information. The response contains key of the inserted element.
{ "SetRdsElements" : { "tRds" : { "id" : "S1!M!S!N3" }, "tArg" : { "op" : "Insert", "key" : { "key" : "" }, "data" : { "n" : "Item 1", "k" : "", "h" : "false", "o" : "0" } } } }
{ "SetRdsElementsResult" : { "id" : { "id" : "S1!M!S!N3" }, "key" : { "key" : "563" } } }
public static SetRdsElementsResult InsertRdsElement(RdsId moniker, string elementName)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetRdsElements()
{
tArg = new SetRdsElementsArg()
{
op = RdsElementOperation.Insert,
key = new ElKey()
{
key = string.Empty
},
//Information about added element. Key is not specified, it will be generated on insert
data = new ElData()
{
k = string.Empty,
n = elementName
}
},
tRds = moniker
};
//Add element
var tResult = somClient.SetRdsElements(tSet);
return tResult;
}
See also: