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
        Next

Etc.


-----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
2)

http://www.MSExchange.org/

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
Summers,OU=Scoobies,DC=sunnydale,DC=muni")
    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
    Loop
    If Not bIsFound Then
           ReDim Preserve vProxyAddresses(nProxyAddresses + 1)
           vProxyAddresses(nProxyAddresses + 1) = sAddress
           objRecip.ProxyAddresses = vProxyAddresses
           oUser.SetInfo
    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: http://www.webelists.com/cgi/lyris.pl?enter=exchangelist
Exchange Newsletters: http://www.msexchange.org/pages/newsletter.asp
Exchange FAQ: http://www.msexchange.org/pages/larticle.asp?type=FAQ
------------------------------------------------------
Other Internet Software Marketing Sites:
World of Windows Networking: http://www.windowsnetworking.com Leading
Network Software Directory: http://www.serverfiles.com
No.1 ISA Server Resource Site: http://www.isaserver.org Windows Security
Resource Site: http://www.windowsecurity.com/ Network Security Library:
http://www.secinf.net/ Windows 2000/NT Fax Solutions:
http://www.ntfaxfaq.com
------------------------------------------------------
You are currently subscribed to this MSEXchange.org Discussion List as:
michael@xxxxxxxxxx To unsubscribe visit
http://www.webelists.com/cgi/lyris.pl?enter=exchangelist
Report abuse to listadmin@xxxxxxxxxxxxxx


Other related posts: