DeleteMetadata

Short Description

Deletes metadata objects from a repository.

Category

Write methods

Syntax

rc=DeleteMetadata(inMetadata,outMetadata,ns,flags,options);

Parameters

Method Parameters
Parameter
Type
Direction
Description
rc
N
out
Return code for the method. For more information, see Return Code.
inMetadata
C
in
Metadata property string that identifies the object to be deleted.
outMetadata
C
out
Returned metadata property string that includes the results of the Delete operation. The outMetadata parameter is used only if OMI_RETURN_LIST is specified.
ns
C
in
Namespace to use as the context for the request.
flags
L
in
OMI_DELETE=32
Valid in the REPOS namespace only. Specifies to delete the contents of a repository and the repository's registration.
OMI_IGNORE_NOTFOUND=134217728
Prevents a Delete operation from being canceled when a request specifies to delete an object that does not exist.
OMI_REINIT=2097152
Valid in the REPOS namespace only. Specifies to delete the contents of a repository, but does not remove the repository's registration from the SAS Repository Manager.
OMI_RETURN_LIST=1024
Specifies to return the identifiers of any dependent objects that were deleted, or of any subordinate objects that were deleted.
OMI_TEMPLATE=4
Valid in the SAS namespace only. Checks the OPTIONS parameter for user-defined templates that specify associated objects to delete with the specified metadata object. The templates are passed in a <TEMPLATES> element in the OPTIONS parameter.
OMI_TRUNCATE=4194304
Valid in the REPOS namespace only. Specifies to delete all metadata objects, but does not delete the metadata object containers from a repository, or remove the repository's registration.
OMI_TRUSTED_CLIENT=268435456
Determines whether the client can call this method. This flag is required.
options
C
in
Passed indicator for options.
<DOAS Credential="credHandle"/>
Enables a client to make a metadata request for another user. For more information, see <DOAS> Option.
<TEMPLATES>
Submits templates that identify associated objects to delete with the specified metadata objects. Each template is submitted in a <TEMPLATE> element within the <TEMPLATES> element. The <TEMPLATES> option must be specified with the OMI_TEMPLATE flag.

Details

The DeleteMetadata method deletes metadata objects from a repository. To replace or modify the properties of a metadata object, use the UpdateMetadata method.
The DeleteMetadata method is typically issued in the SAS namespace to delete metadata representing application elements. The method can also be issued in the REPOS namespace on a RepositoryBase object to unregister the repository, to destroy the repository, or to clear all objects from the repository without harming the repository's registration. Flags that are valid only in the REPOS namespace are provided to perform these tasks. For more information, see Deleting a Repository. You must have administrative status on the SAS Metadata Server to issue the DeleteMetadata method in the REPOS namespace. For more information about administrative user status, see the SAS Intelligence Platform: Security Administration Guide.
Regardless of the namespace in which it is issued (REPOS or SAS), a DeleteMetadata method call must set the OMI_TRUSTED_CLIENT flag (268435456). The OMI_TRUSTED_CLIENT flag is required in all method calls that write or remove metadata.
The object to delete is primarily identified in a metadata property string that is submitted to the method in the INMETADATA parameter. To delete multiple objects, stack their metadata property strings in the INMETADATA parameter.
In addition to deleting specified SAS Metadata Model objects, a DeleteMetadata method issued in the SAS namespace deletes associated objects using a type definition from the SAS type dictionary, or, when the OMI_TEMPLATE flag is set, associated objects that are specified in a template. For usage information, see Deleting Metadata Objects.
Check the return code of a DeleteMetadata method call. A nonzero return code indicates that a failure occurred while trying to delete the metadata objects. A nonzero return code means none of the changes indicated by the method call were made.

Example 1: Standard Interface

The following is an example of how to issue the DeleteMetadata method regardless of the programming environment. The request deletes a SASLibrary object. When a SASLibrary object is deleted, any object in the library is deleted as well. The OMI_RETURN_LIST flag is specified (268435456 + 1024 =268436480) so the OUTMETADATA parameter returns the identifiers of all deleted objects.
inMetadata="<SASLibrary Id='A2345678.A2000001'/>";
outMetadata="";
ns= "SAS";
flags= 268436480;
options= "";

rc = DeleteMetadata(inMetadata, outMetadata, ns, flags, options);

Example 2: DoRequest Method

The following is an example of an XML string that shows how to format the method call in example 1 for the INMETADATA parameter of the DoRequest method.
<!-- XML string for inMetadata= parameter of DoRequest method call -->

<DeleteMetadata>
  <Metadata>
    <SASLibrary Id="A2345678.A2000001"/>
  </Metadata>
  <NS>SAS</NS>
  <Flags>268436480</Flags>
  <Options/>
</DeleteMetadata>

Related Methods