The IADsPropertyList::ResetPropertyItem method removes the specified item from the list; that is, from the cache. You can specify the item to be removed by name (as a string) or by index (as an integer).
This method supports the standard HRESULT return values, including S_OK. For more information and other return values, see ADSI Error Codes.
ResetPropertyItem only affects the contents of the cache and does not affect the properties on the actual object in the directory; that is calling SetInfo after calling ResetPropertyItem does not delete the properties on the directory object.
The following code example shows how to implement ResetPropertyItem.
Dim propList As IADsPropertyList
On Error GoTo Cleanup
Set propList = GetObject("LDAP://DC=Fabrikam,DC=com")
'--- Now modify the cache using PutPropertyItem
Set propVal = New PropertyValue
'--- Property Value-----
propVal.CaseIgnoreString = "Fabrikam"
propVal.ADsType = ADSTYPE_CASE_IGNORE_STRING
' Commit to the directory. Without this, the changes take place only in the cache.
Debug.Print " Number of Properties = " & propList.PropertyCount
' the property count should have been reduced by one.
Debug.Print "Number of properties = " & propList.PropertyCount
If (Err.Number<>0) Then
MsgBox("An error has occurred. " & Err.Number)
Set propList = Nothing
Set propVal = Nothing
Set propEntry = Nothing
The following code example shows the effect produced by a call to IADsPropertyList::ResetPropertyItem. For more information and the listing of the GetPropertyCache function, see IADsPropertyList. For more information and the listing of the GetNextEntry and PropertyItem functions, see IADsPropertyList::Next and IADsPropertyList::Item respectively.
The feedback system for this content will be changing soon. Old comments will not be carried over. If content within a comment thread is important to you, please save a copy. For more information on the upcoming change, we invite you to read our blog post.