Below is the example of using the DeleteObjects operation to delete one repository object. The request contains the repository connection moniker and the key of the deleted object.
The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.
{
"DeleteObjects" :
{
"tMb" :
{
"id" : "FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M"
},
"tArg" :
{
"objectKey" : "304999"
}
}
}
{
"DeleteObjectsResult" : ""
}
public static DeleteObjectsResult DelObject(MbId mb, string id)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Get description of object that is to be deleted
var tObject = FindObjectById(mb, id);
//Operation execution parameters
var tDel = new DeleteObjects()
{
tArg = new DeleteObjectsArg()
{
objectKey = tObject.k
},
tMb = new MbId() { id = mb.id }
};
//Delete object
var result = somClient.DeleteObjects(tDel);
return result;
}
See also: