DeleteObject(Key: Integer);
Key. Key of the object that is being deleted.
The DeleteObject method deletes the object, which key is sent by input parameter.
The method does throw an exception if the object with the specified key is absent in the repository.
When a document is deleted, its cache is automatically cleared. To clear cache of all documents, use the IMetabase.ClearDocumentCacheFiles method.
Executing the example requires that the repository contains an object with the TestObj identifier.
Add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
Obj: IMetabaseObjectDescriptor;
Begin
MB := MetabaseClass.Active;
Obj := MB.ItemById("TestObj");
MB.DeleteObject(Obj.Key);
End Sub UserProc;
After executing the example if the repository contains an object with the TestObj identifier, it is deleted.
See also: