다음을 통해 공유


IADsDeleteOps 인터페이스

IADsDeleteOps 인터페이스는 기본 디렉터리 저장소에 대한 감독 및 유지 관리 루틴에 사용됩니다. 단일 작업에서 리프 개체 및 전체 하위 트리를 삭제할 수 있습니다.

이 인터페이스가 지원되지 않는 경우 Active Directory에서 개체를 삭제하려면 포함된 각 개체를 재귀적으로 열거하고 삭제해야 합니다. 이 인터페이스를 사용하면 포함된 모든 개체와 하위 개체가 있는 모든 컨테이너 개체를 단일 작업으로 삭제할 수 있습니다.

다음 코드 예제에서는 "Eng" 컨테이너 및 모든 자식 개체를 삭제합니다.

HRESULT hr;
IADsDeleteOps *pDeleteOps;
LPWSTR pwszUsername = NULL;
LPWSTR pwszPassword = NULL;

// Insert code to securely retrieve the pwszUsername and pwszPassword
// or leave as NULL to use the default security context of the 
// calling application.
 
// Bind to the LDAP provider.
hr = ADsOpenObject(L"LDAP://CN=Eng,CN=Users,DC=Fabrikam,DC=Com", 
    pwszUsername,
    pwszPassword,
    0,
    ADS_SECURE_AUTHENTICATION,
    IID_IADsDeleteOps, 
    (void**)&pDeleteOps);
if(S_OK == hr)
{
    // Delete the container and all child objects.
    pDeleteOps->DeleteObject(0);

    // Release the interface.
    pDeleteOps->Release();
}

if(pwszUsername)
{
    SecureZeroMemory(pwszUsername, lstrlen(pwszUsername) * sizeof(TCHAR));
}
if(pwszPassword)
{
    SecureZeroMemory(pwszPassword, lstrlen(pwszPassword) * sizeof(TCHAR));
}

다음 코드 예제에서는 "Eng" 컨테이너 및 모든 자식 개체를 삭제합니다.

Dim DeleteOps As IADsDeleteOps

' Bind to the LDAP provider.
Set DeleteOps = GetObject("LDAP://CN=Eng,CN=Users,DC=Fabrikam,DC=Com")

' Delete the container and all child objects.
DeleteOps.DeleteObject (0)