CreateCustomObResult CreateCustomOb(OdId tParent, CreateCustomObArg tArg)
tParent. Moniker of parent object, in which a custom class object is created.
tArg. Operation execution parameters.
The CreateCustomOb operation creates a custom class object.
To execute the operation, in the tParent field specify parent object moniker, and in the tArg.classId field specify identifier of created object class. Class identifier is available in custom class metadata that can be obtained using the OpenCustomExtender, GetCustomExtender operations.
The operation results in the moniker and description of the created class. The object is created as a temporary one, it should be saved to appear in the repository.
If a web form is set for the object class of the operation, the operation results in the key of this web form. Further work with the obtained object is executed using the GetCustomOb, SetCustomOb operations or on the web form. To open the web form, use the OpenWebForm operation, object information is sent in the cstmArgs field. In order the object is appeared in the repository, it should be saved. The object can be saved in web form code or using the SaveObject/SaveObjectAs operation.
Below is the example of creating a custom class object. The request contains parent folder moniker or identifier of created object class. The response contains the moniker and description of the created temporary object.
{
"CreateCustomOb" :
{
"tParent" :
{
"id" : "KIJGJLGLBNIEGOAEKKDNNHHCKMKIANEEPIGPOKBNCCCNDLDC!M!10099"
},
"tArg" :
{
"classId" : "2168577"
}
}
}
{
"CreateCustomObResult" :
{
"createResult" :
{
"id" :
{
"id" : "KIJGJLGLBNIEGOAEKKDNNHHCKMKIANEEPIGPOKBNCCCNDLDC!M!S!OGJDCJCHLBNIEGOAEEJEBKIOHBNBIFPPEIIEEIAFBMGNGGONL"
},
"object" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "1",
"@hf" : "0",
"i" : "OBJ10106",
"n" : "Custom object",
"k" : "10106",
"c" : "2168577",
"p" : "10099",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0"
}
}
}
}
public static CreateCustomObResult CreateCustomOb(string parentMon, uint classId)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tNew = new CreateCustomOb()
{
tArg = new CreateCustomObArg()
{
classId = classId
},
tParent = new OdId() { id = parentMon }
};
// Create a custom class object
var tResult = somClient.CreateCustomOb(tNew);
return tResult;
}
See also: