Scripting Exchange Using VBScript and ADSI (Part 2)

  • From: "Jimmy" <nevyn@xxxxxxx>
  • To: exchangelist@xxxxxxxxxxxxx
  • Date: Tue, 17 May 2005 14:57:04 -0600

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?

Other related posts: