Platform SDK: Active Directory, ADSI, and Directory Services

IADsPropertyList::PurgePropertyList

The IADsPropertyList::PurgePropertyList method deletes all items from the property list.

HRESULT PurgePropertyList(void);

Return Values

This method supports the standard HRESULT return values, including S_OK. For other return values, see ADSI Error Codes.

Remarks

When the PurgePropertyList method is called, all the items are removed from the cache. Thus, calling GetPropertyItem after that will generate an error.

Example Code [Visual Basic]

The following Visual Basic code snippet shows how IADsPropertyList::PurgePropertyList method is used.

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

Example Code [C++]

The following C++ code snippet shows the effect produced by a call to IADsPropertyList::PurgePropertyList.

IADsPropertyList *GetPropertyCache(LPWSTR);
 
void TestPurgePropertyList()
{
    IADsPropertyList *pList;
    pList=GetPropertyCache(L"WinNT://myComputer,computer");
 
    long count;
    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);
}

Requirements

  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
  Windows 95/98: Requires Windows 95 or later (with DSClient).
  Header: Declared in Iads.h.

See Also

ADSI Error Codes, IADsPropertyList, IADsPropertyList::GetPropertyItem, IADsPropertyList Property Methods