Help and Support
 

powered byLive Search

HOWTO: Speed Up ADSI Group & Dist. List Membership Checks

Article ID:192950
Last Review:November 15, 2006
Revision:2.3
This article was previously published under Q192950
On This Page

SUMMARY

In some providers, the ADSI groupobject.IsMember(memberADsPath) method is implemented to perform membership checks by returning the entire members collection to the client and then searching for the target's path in the collection. This operation can consume a lot of time and bandwidth if the object has a large membership list, like an Exchange distribution list. You can avoid much of this overhead if the following is true:
1.You need the object only for a membership test.
2.You are using a provider that supports OLE DB.
In this case, you can do an ADO or OLE DB query and perform the search on the server. This way, only a single record is returned to the client.

The LDAP and NDS providers supplied with the ADSI runtime support this technique.

Back to the top

MORE INFORMATION

The following code illustrates the equivalent of the IADsGroup::IsMember method in Visual Basic using the ADO technique. You can use this code to check membership in an Exchange 5.5 distribution list. Note that this code, like the LDAP IADsGroup::IsMember method, does not check for membership in distribution lists that are members of the target distribution list.

Back to the top

Sample Code

   Function IsMember(strDLPath As String, strMemberPath As String _
      ) As Boolean

   ' strDLPath is ADsPath to distribution list.
   ' strMember is ADsPath to member.

   Dim conn As New ADODB.Connection
   Dim rs As ADODB.Recordset
   Dim adsMember As IADsUser

   IsMember = False

   Set adsMember = GetObject(strMemberPath)
   If adsMember Is Nothing Then Exit Function 'I corrected from adsMemeber

   conn.Provider = "ADsDSOObject"
   conn.Open ""
   Set rs = conn.Execute( "<" + strDLPath + ">;(member=" + _

      adsMember.Get("distinguishedName") + ");ADsPath;Base")

   IsMember = Not (rs.BOF Or rs.EOF)

   End Function
				

Back to the top

REFERENCES

Microsoft Developer Network: ADSI

Back to the top


APPLIES TO
Microsoft Windows 95
Microsoft Windows NT Server 4.0 Standard Edition
Microsoft Windows NT Workstation 4.0 Developer Edition

Back to the top

Keywords: 
kbapi kbhowto kbnetwork KB192950

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by E-mail, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.