Below is the example of using the DeleteObjects operation to delete multiple objects from the repository. The request contains moniker of repository connection and description of deleted objects.
{
"DeleteObjects" :
{
"tMb" :
{
"id" : "S1!M"
},
"tArg" :
{
"objects" :
{
"its" :
{
"d" :
[
{
"@isShortcut" : "false",
"@isLink" : "false",
"@hf" : "false",
"i" : "NEWFORM1",
"n" : "NewForm1",
"k" : "176176",
"c" : "1538",
"p" : "65",
"h" : "false",
"hasPrv" : "false",
"ic" : "false"
},
{
"@isShortcut" : "false",
"@isLink" : "false",
"@hf" : "false",
"i" : "NEWFORM2",
"n" : "NewForm2",
"k" : "176177",
"c" : "1538",
"p" : "65",
"h" : "false",
"hasPrv" : "false",
"ic" : "false"
}
]
}
}
}
}
}
{
"DeleteObjectsResult" : ""
}
The specified DelObjects function deletes several repository objects. The monikers of repository connection and description of the deleted objects are sent as input parameters of the function. The result of the function is the result of the operation.
Object descriptions can be obtained by means of the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.
public static DeleteObjectsResult DelObjects(MbId mb, Od[] objects)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tDel = new DeleteObjects()
{
tArg = new DeleteObjectsArg()
{
objects = new Ods
{
its = objects
}
},
tMb = new MbId() { id = mb.id }
};
//Delete objects
var result = somClient.DeleteObjects(tDel);
return result;
}
See also: