RE: VBscript-CDO and adding SMTP address to user

  • From: "Sargent Joey E" <joey@xxxxxxxxxxxxxxx>
  • To: "[ExchangeList]" <exchangelist@xxxxxxxxxxxxx>
  • Date: Mon, 22 Apr 2002 11:05:42 -0400

The SMTPEmail works fine, but I am having problems with the
proxyaddresses procedure.
 
I am VBscript and CDO.  On my box your procedure breaks at this line...
  nProxyAddresses = UBound(vProxyAddresses)
 
Could it be that VBscripts is having a problem with the UBound?
 
I have tried this also by using just this line and assigning the correct
variables.....
  oMailRecipient.ProxyAddresses = vProxyAddresses
 
It works and adds the address to the my email addresss window.  The
problem is that there is no SMTP listed before it and eventually it
disappears from the list.  My guess is that this line only adds the
address and does not append it to the actual ProxyAddresses list.
 
Any ideas on how to reformt the code to make it work for me.  At least
you did help me get the default address set.
 
Joe S.

-----Original Message-----
From: Malcolm K Smith [mailto:malcolm.smith@xxxxxxxxxxxxxx] 
Sent: Monday, April 22, 2002 7:12 AM
To: [ExchangeList]
Subject: [exchangelist] RE: VBscript-CDO and adding SMTP address to user


http://www.MSExchange.org/


Joe
 
If you select the object in code which you wish to have the extra
address as a MAPI object then what you can do is this:
 
  with OMailRecipient
   .SMTPEmail = " <mailto:malcolm.smith@xxxxxxxxxxxxxx>
malcolm.smith@xxxxxxxxxxxxxx"
  end with
 
This changes the SMTP default address.
 
To add an extra address to the object you have to extend the
.ProxyAddresses property.
 
 
This is held as an array of Variant type and all you do is to add an
extra element to the array and then save the array to the object.   I am
doing this right this very moment as I am writing a MajorDomo type
mailing list thing for Exchange 2000 and I am creating new public
folders with e-mail enabled.
 
Anyway, here is a routine which may be useful to add an address to the
ProxyAddresses property of the object.
 
If you have any questions then please shout.
 
Malc
   <http://www.dragondrop.com> www.dragondrop.com
 
 
Private Sub AddAddressToProxyAddresses(oMailRecipient As
cdoexm.IMailRecipient, sAddress As String)
 
  Dim vProxyAddresses As Variant
  Dim nProxyAddresses As Long
  Dim nProxyAddress As Long
  Dim bIsFound As Boolean
  
  
  bIsFound = False
 
  vProxyAddresses = oMailRecipient.ProxyAddresses
  nProxyAddresses = UBound(vProxyAddresses)
  nProxyAddress = 0
  
  Do While nProxyAddress <= nProxyAddresses
    If vProxyAddresses(nProxyAddress) = sAddress Then
      bIsFound = True
      Exit Do
    End If
    nProxyAddress = nProxyAddress + 1
  Loop
  
  If Not bIsFound Then
    ReDim Preserve vProxyAddresses(nProxyAddresses + 1)
    vProxyAddresses(nProxyAddresses + 1) = sAddress
    oMailRecipient.ProxyAddresses = vProxyAddresses
  End If
 
End Sub
 

-----Original Message-----
From: Sargent Joey E [mailto:joey@xxxxxxxxxxxxxxx]
Sent: 21 April 2002 05:18
To: [ExchangeList]
Subject: [exchangelist] VBscript-CDO and adding SMTP address to user


http://www.MSExchange.org/


I want to add a secondary and a default address to the various users
mailboxes via a VB script and CDO.  I have the mailbox creation working,
but cannot figure out the syntax for adding a secondary or default SMTP
email address.
 
Thanks,
Joe S.

 

------------------------------------------------------
You are currently subscribed to this MSExchange.org Discussion List as:
malcolm.smith@xxxxxxxxxxxxxx
To unsubscribe send a blank email to
$subst('Email.Unsub') 

------------------------------------------------------
You are currently subscribed to this MSExchange.org Discussion List as:
joey@xxxxxxxxxxxxxxx
To unsubscribe send a blank email to
$subst('Email.Unsub') 

Other related posts: