IMetabase.DeleteObject

Syntax

DeleteObject(Key: Integer);

Parameters

Key. Key of the object that is being deleted.

Description

The DeleteObject method deletes the object, which key is sent by input parameter.

Comments

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.

Example

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:

IMetabase