WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI LDAP CDO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

CDO Collections to Search Personal Address Book

Keywords: 	 CDO Collections 

Turns out this works with winbatch 2000c.

You'll need to visit the microsoft website and look for the CDO download for your OS if you don't have it already.

This checks the Personal Address Book on the PC, find which ones are Personal Distribution Lists and shows you who is on the list.

  1. All the objects are closed when no longer needed...

  2. Runs on NT Server 4.0 and Winbatch 2000c...

  3. The CDO.DLL is

    version = 5.5.2448.0

Collaboration Data Objects 1.21 for Windows NT
;       setup the profile to logon to...
strProfileInfo = strcat("user", @lf, "server")

;       open the mapi session object and logon...
objSession = Objectopen("MAPI.Session")

objSession.Logon( , , @false, @false, , @True, strProfileInfo)

;       set the personal address book object, and its entries...
pab = objSession.AddressLists("Personal Address Book")

pabEntries = pab.AddressEntries

;       if you use the COUNT var it returns a HUGE number (this is MS standard! Heh!)
message("Entry Count", pabEntries.count)

;       lets do our own count...
entrycount = 0
loopstart = 1

;       loop until no more objects in the collection...
;suppress the minor errors...

errormode(@off)

while @true
        entry = pabEntries.item(loopstart)      
        if entry > 0 ; if entry == 0 then there's no object in the collection...
;               since there is one increment...
                loopstart = loopstart + 1
        else
;               no more objects then leave the loop...
                break
        endif
endwhile

;       reset the errormode...
errormode(@cancel)

;;objectclose(entry)

;       one too many objects so decrement the count...
entrycount = loopstart - 1
;       show how many entries in the PAB...

message("Number of Entries", entrycount)
;       now go into each entry and find the PERSONAL DISTRIBUTION LISTS...
for y = 1 to entrycount
        entry = pabEntries.item(y)
        if entry > 0
                if entry.type == "MAPIPDL" ; this means a PDL...
                ;       show the entry's name...
                        message("Entry", entry.name)
                        ;       now check to see how many members in this PDL...
                        pdlentries = entry.members
                        ;       same looping strategy as above...
                        subentrycount = 0
                        loopstart = 1
                        ;suppress the minor errors...
                        errormode(@off)
                        while @true
                                subentry = pdlentries.item(loopstart)
                                if subentry > 0 ; if no object leave the loop...otherwise increment...
                                        loopstart = loopstart + 1
                                else
                                        break
                                endif
                        endwhile

                        ;       reset the errormode...
                        errormode(@cancel)

                        ;       decrement the counter by 1...
                        subentrycount = loopstart - 1

                        ;       show how many entries in the PDL...
                        message("PDL Entries", subentrycount)

                        ;       now loop thru the PDL and show each entry's address...
                        for z = 1 to subentrycount
                                address = pdlentries.item(z)
                                message("Address in PDL for...", address.name)
                        next
                endif
        endif
next

;       cleanup and go home...
objectclose(address)
objectclose(entry)
;;objectclose(subentry)
objectclose(pdlentries)
objectclose(pab)
objectclose(pabEntries)
objectclose(objSession)

exit



Article ID:   W14664
Filename:   CDO Collections and Personal Address Book.txt
File Created: 2000:10:10:10:34:36
Last Updated: 2000:10:10:10:34:36