Deleting One Object

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<DeleteObjects xmlns="http://www.fsight.ru/PP.SOM.Som">
<tMb xmlns="">
  <id>FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M</id>
  </tMb>
<tArg xmlns="">
  <objectKey>304999</objectKey>
  </tArg>
  </DeleteObjects>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
  <DeleteObjectsResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"DeleteObjects" :
{
"tMb" :
{
"id" : "FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M"
},
"tArg" :
{
"objectKey" : "304999"
}
}
}

JSON response:

{
"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:

DeleteObjects: Operation