Previous Page | Next Page

Deleting Metadata Objects

Deleting Associated Objects Using a User-Defined Template

A DeleteMetadata request that specifies associated objects to delete has the following characteristics:

  1. It identifies the primary or top-level metadata object to delete in the INMETADATA parameter.

  2. In addition to the metadata type and Id= value of the target object, the INMETADATA property string specifies a TemplateName= attribute that specifies the name of a user-defined template. For example, TemplateName="MyTemplate".

  3. It sets the OMI_TEMPLATE (4) and OMI_TRUSTED_CLIENT (268435456) flags in the FLAGS parameter.

  4. It submits a <TEMPLATE> element within a <TEMPLATES> element in the OPTIONS parameter that specifies the metadata type from the INMETADATA parameter and identifies the associations that you want to delete.

  5. The opening <TEMPLATE> tag includes a TemplateName= attribute and value that matches the TemplateName= value in the INMETADATA parameter.

The following is an example of a DeleteMetadata request that submits a user-defined template. The request is formatted for the INMETADATA parameter of the DoRequest method.

<DeleteMetadata>
   <Metadata>
      <MetadataType  Id="reposid.objectid" TemplateName="myassns"/>
  </Metadata>
 <NS>SAS</NS>
<!--OMI_TEMPLATE +  OMI_TRUSTED_CLIENT + OMI_RETURN_LIST  -->
<Flags>268436484</Flags>
<Options>
    <Templates>
       <Template TemplateName="myassns">
           <MetadataType>
               <AssociationName1/>
               <AssociationName2/>
               <AssociationName3/>
           </MetadataType>
      </Template>
     </Templates>
  </Options>
</DeleteMetadata>

Note the inclusion of the attribute TemplateName="myassns" in both the metadata property string in the <METADATA> element and the <TEMPLATE> element in the OPTIONS parameter. The content of the template specifies the same metadata type as the property string in the <METADATA> element and specifies the names of the associations that you want to delete.

Note how the <TEMPLATE> element is enclosed within a <TEMPLATES> element in the OPTIONS parameter. The use of a <TEMPLATE> element within a <TEMPLATES> element is unique to the DeleteMetadata method. It is supported to enable multiple objects and their associated objects to be deleted in a DeleteMetadata request. The property strings in the <METADATA> element are scoped to the appropriate template in the OPTIONS parameter using the value in the TemplateName= attribute.

The following is an example of a DeleteMetadata request that specifies to delete two objects and their associated objects:

<DeleteMetadata>
   <Metadata>
      <MetadataType1 Id="reposid.objectid" TemplateName="Template1"/>
      <MetadataType2 Id="reposid.objectid" TemplateName="Template2"/>
  </Metadata>
 <NS>SAS</NS>
<!--OMI_TEMPLATE +  OMI_TRUSTED_CLIENT + OMI_RETURN_LIST-->
<Flags>268436484</Flags>
<Options>
    <Templates>
       <Template TemplateName="Template1">
           <MetadataType1>
               <AssociationName1/>
               <AssociationName2/>
               <AssociationName3/>
           </MetadataType1>
      </Template>
      <Template TemplateName="Template2">
           <MetadataType2>
               <AssociationName1/>
               <AssociationName2/>
               <AssociationName3/>
           </MetadataType2>
      </Template>
     </Templates>
  </Options>
</DeleteMetadata>

The second example specifies two property strings in the <METADATA> element. Note how the TemplateName= value in each string maps to a <TEMPLATE> element with a matching TemplateName= value in the OPTIONS parameter.

For more information about how to create a template, see Using Templates.

Previous Page | Next Page | Top of Page