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

  • From: "Jimmy" <nevyn@xxxxxxx>
  • To: exchangelist@xxxxxxxxxxxxx
  • Date: Thu, 19 May 2005 13:29:06 -0600

That was kinda what I was thinking was the problem.   I guess I should
have thought of setting a recipient policy.  But is it possible to set the
Recipient Policy of an individual account using VBScript?

Thank you both for your help and advice.

> 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 =3D 0
>       For Each strAddress in objRecip.ProxyAddresses
>               If strAddress =3D sAddress Then
>                       bIsFound =3D True
>                       Exit For
>               End If
>               i =3D i + 1
>       Next
> 
> Etc.
> 
> 
> -----Original Message-----
> From: Jimmy [mailto:nevyn@xxxxxxx]=20
> 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 =3D GetObject ("LDAP://CN=3DBuffy
> Summers,OU=3DScoobies,DC=3Dsunnydale,DC=3Dmuni")
>     Set objRecip =3D oUser
>     sAddress =3D "smtp:slayer@xxxxxxxxxxxxxx"
>     bIsFound =3D False
>     vProxyAddresses =3D objRecip.ProxyAddresses
>     nProxyAddresses =3D UBound(vProxyAddresses)
>     i =3D 0
>     Do While i <=3D nProxyAddresses
>           If vProxyAddresses(i) =3D sAddress  Then
>              bIsFound =3D True
>                 Exit Do
>           End If
>           i =3D i + 1
>     Loop
>     If Not bIsFound Then
>            ReDim Preserve vProxyAddresses(nProxyAddresses + 1)
>            vProxyAddresses(nProxyAddresses + 1) =3D sAddress
>            objRecip.ProxyAddresses =3D 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=3Dexchangelist
> Exchange Newsletters: http://www.msexchange.org/pages/newsletter.asp
> Exchange FAQ: http://www.msexchange.org/pages/larticle.asp?type=3DFAQ
> ------------------------------------------------------
> 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=3Dexchangelist
> Report abuse to listadmin@xxxxxxxxxxxxxx


Other related posts: