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.
{
"DeleteObjects" :
{
"tMb" :
{
"id" : "S1!M"
},
"tArg" :
{
"objectKey" : "176175"
}
}
}
{
"DeleteObjectsResult" : ""
}
The specified DelObject function deletes one object in the repository. The repository connection moniker and identifier of the deleted object are sent as input parameters of the function. The example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example. FindObjectById is used to get description of the object, from which the object key is taken to specify in the objectKey field later. The result of the function is the result of the operation.
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: