Método IADsPropertyList::P urgePropertyList (iads.h)

O método IADsPropertyList::P urgePropertyList exclui todos os itens da lista de propriedades.

Sintaxe

HRESULT PurgePropertyList();

Valor retornado

Esse método dá suporte aos valores de retorno HRESULT padrão, incluindo S_OK. Para obter mais informações e outros valores retornados, consulte Códigos de erro ADSI.

Comentários

Quando o método PurgePropertyList é chamado, todos os itens são removidos do cache. Assim, chamar GetPropertyItem depois disso gerará um erro. Lembre-se de que PurgePropertyList afeta apenas o conteúdo do cache e não afeta as propriedades no objeto real no diretório; ou seja, chamar SetInfo depois de chamar PurgePropertyList não exclui as propriedades no objeto de diretório.

Exemplos

O exemplo de código a seguir mostra como implementar IADsPropertyList::P urgePropertyList.

Dim propList As IADsPropertyList
 
On Error GoTo Cleanup

Set propList = GetObject("LDAP://dc03/DC=Fabrikam,DC=com")
propList.GetInfo
 
propList.PurgePropertyList
 
'- None of GetPropertyItem should work, because the list is purged.
'- The following line should generate error.
Set propEntry = propList.GetPropertyItem("adminDescription", ADSTYPE_CASE_IGNORE_STRING)

Cleanup:
    If (Err.Number<>0) Then
        MsgBox("An error has occurred. " & Err.Number)
    End If

    Set propList = Nothing

O exemplo de código a seguir mostra o efeito produzido por uma chamada para IADsPropertyList::P urgePropertyList. Para obter mais informações sobre a função GetPropertyCache e um exemplo de código, consulte IADsPropertyList.

IADsPropertyList *GetPropertyCache(LPWSTR);
 
void TestPurgePropertyList()
{
    IADsPropertyList *pList;
    pList=GetPropertyCache(L"WinNT://myComputer,computer");
 
    long count;

    if(pList)
    {
        pList->get_PropertyCount(&count);
        printf("Number of properties before purging: %d\n",count);
 
        count = -1;
        pList->PurgePropertyList();
        pList->get_PropertyCount(&count);
        printf("Number of properties after purging: %d\n",count);
    }
}

Requisitos

   
Cliente mínimo com suporte Windows Vista
Servidor mínimo com suporte Windows Server 2008
Plataforma de Destino Windows
Cabeçalho iads.h
DLL Activeds.dll

Confira também

Códigos de erro ADSI

IADsPropertyList

Métodos de propriedade IADsPropertyList

IADsPropertyList::GetPropertyItem