GlobalConfig.DeleteSiteConfig: Cannot Delete Site When Resources Exist (277045)



The information in this article applies to:

  • Microsoft Commerce Server 2002
  • Microsoft Commerce Server 2000

This article was previously published under Q277045

SYMPTOMS

If you use the Globalconfig object programmatically, and you delete a Web site that has resources by using the globalconfig.deletesiteconfig method, you may receive one of the following error messages:
Run-time error -2147467259(80004005)
Cannot Delete Site with resources
MSCSGroupConfigAdmin.cls:DeleteSiteConfig,
In an ADSite:
Automation Error: The directory service can perform the requested operation only on a leaf object.

CAUSE

Typically, only the Commerce Site Packager or the Microsoft Management Console (MMC) uses the DeleteSiteConfig method. Also, the program that uses the DeleteSiteConfig method is expected to delete all resources before calling this method.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Unpack the Retail Site.
  2. In a Visual Basic EXE, add a reference to the Microsoft Commerce Server configuration type library.
  3. Run the following code:
    Dim globalconfig As New globalconfig
    globalconfig.initialize ""
    globalconfig.DeleteSiteConfig "retail"
To successfully delete the Retail Site, you must first delete all resources in the site. For example, the following code successfully removes the site without error:
Dim globalconfig As New globalconfig
Dim siteconfig As New siteconfig

siteconfig.Initialize ("retail")
globalconfig.Initialize ""

Set Fields = siteconfig.Fields

For Each field In Fields
     If field.Attributes = 8208 Then
          resource = field.Name
          siteconfig.DeleteComponentConfig resource
     End If
Next

globalconfig.DeleteSiteConfig "retail"
				

Modification Type:MajorLast Reviewed:10/22/2003
Keywords:kbpending kbprb KB277045