RE: Scripting Exchange Using VBScript and ADSI (Part 2)

  • From: "Michael B. Smith" <michael@xxxxxxxxxx>
  • To: "[ExchangeList]" <exchangelist@xxxxxxxxxxxxx>
  • Date: Tue, 17 May 2005 22:34:32 -0400

A couple of things:

1) If it hurts, don't do it. :-P

Right after you have created a user, it doesn't have any proxyAddresses,
until the Recipient Update Service has executed and stamped the user.
This is, in general, about two minutes later.

2) Manually modifying proxyAddresses is the wrong way to do this. Modify
the Recipient Policy instead, so that when RUS executes, it creates the
addresses you want.

3) And regardless of the logic flaws above, don't use that algorithm.
Webster was correct. In this case, the value was Null. You can special
case that code, or you can write something a little more robust:

        i = 0
        For Each strAddress in objRecip.ProxyAddresses
                If strAddress = sAddress Then
                        bIsFound = True
                        Exit For
                End If
                i = i + 1


-----Original Message-----
From: Jimmy [mailto:nevyn@xxxxxxx] 
Sent: Tuesday, May 17, 2005 4:57 PM
To: [ExchangeList]
Subject: [exchangelist] Scripting Exchange Using VBScript and ADSI (Part

I'm trying to use a VBScript as part of an ASP page that will create a
user account and create a mailbox for the user at the same time.  I've
managed to get this part of it working with no problems.  However, what
I also want to do is when the mailbox is created I want it to also add a
secondary address.  When I used the following code

Set oUser = GetObject ("LDAP://CN=Buffy
    Set objRecip = oUser
    sAddress = "smtp:slayer@xxxxxxxxxxxxxx"
    bIsFound = False
    vProxyAddresses = objRecip.ProxyAddresses
    nProxyAddresses = UBound(vProxyAddresses)
    i = 0
    Do While i <= nProxyAddresses
          If vProxyAddresses(i) = sAddress  Then
             bIsFound = True
                Exit Do
          End If
          i = i + 1
    If Not bIsFound Then
           ReDim Preserve vProxyAddresses(nProxyAddresses + 1)
           vProxyAddresses(nProxyAddresses + 1) = sAddress
           objRecip.ProxyAddresses = vProxyAddresses
    End If

which is from the example in the article "Scripting Exchange Using
VBScript and ADSI (Part 2)" I get errors.  The main error that I can't
seem to eleviate is an error '800a00d' which says Ubound has a type
mismatch.   Can anyone tell me what I might be doing wrong?

List Archives:
Exchange Newsletters:
Exchange FAQ:
Other Internet Software Marketing Sites:
World of Windows Networking: Leading
Network Software Directory:
No.1 ISA Server Resource Site: Windows Security
Resource Site: Network Security Library: Windows 2000/NT Fax Solutions:
You are currently subscribed to this Discussion List as:
michael@xxxxxxxxxx To unsubscribe visit
Report abuse to listadmin@xxxxxxxxxxxxxx

Other related posts: