Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem traslating VB code
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00761378
Message ID:
00761410
Vues:
29
I've run into this as well... you can't just assign a VFP array to a property as you can in VB. Instead, in cases where I had access to source code, Ihave had to write a separate method to accept an array parameter, and then assign the array within the VB code... pretty simple, but again, only if you have access to the source code.

I haven't worked CDO for Exchange Management. Is the source code available? Or, better yet, is there already some method that will accept an array and do what I described? (That's probably hoping for too much, but....)

If you don't have access to the source code, and there's no alternative approach to pass the array as a parameter, you could write a VB wrapper that would accept the array as a parameter (along with other parameters), create a CDOEXM reference, and then assign the array to the ProxyAddresses property. This won't be as hard as it may sound. If you get to a point of needing this, let me know and I'd be happy to help.


>I have a little problem.
>
>i need to make a program to maintain Active directory and Exchange 2000 accounts
>and my Fox traslation of original Microsoft VB sample do not works.
>
>One user can have many e-mail address, and that addresses are passed with an
>array.
>
>The problem is assigning an array to a property of a object,
>when i use the syntax (@array) to pass the address fox returns a syntax error,
>and if i write property=array only updates one value, not all the address contained
>on the array.
>
>the code works well, but only updates one e-mail address.
>
>
>I'm testing with COMARRAY function but with no result.
>
>some ideas?
>Thanks in advance
>
>
>
>
>
>
>ORIGINAL VB code
>================
>
>
>Visual Basic
>Sub SetProxyAddress(recipname As String, _
> DomainName As String)
>
> 'DomainName is something like "DC=MYDOMAIN3,DC=microsoft,DC=com"
> 'recipname is something like "jamessmith"
>
> Dim objPerson As New CDO.Person
> Dim objMailRecip As CDOEXM.IMailRecipient
> Dim i
>
> objPerson.DataSource.Open "LDAP://CN=" + recipname + _
> ",CN=users," + DomainName
>
>
> 'Capitalized proxy type for proxies(1) makes it the primary (reply) address.
> 'the others are receive only.
> Dim proxies(3) As Variant
> proxies(0) = "smtp:user@secondarymailproxy.microsoft.com"
> proxies(1) = "SMTP:user@primarymailproxy.microsoft.com"
> proxies(2) = "X400:c=us;a= ;p=Domain;o=First Organization;s=user;"
>
> Set objMailRecip = objPerson
> objMailRecip.ProxyAddresses = proxies
>
> 'look at the results
> Debug.Print Chr(13) + Chr(13) + Chr(13) + Chr(13) + Chr(13) 'add some space
> For i = LBound(objMailRecip.ProxyAddresses) To UBound(objMailRecip.ProxyAddresses)
> Debug.Print objMailRecip.ProxyAddresses(i)
> Next
>
> objPerson.DataSource.Save
> MsgBox "Proxy addresses for " + recipname + " set successfully"
>
>End Sub
>
>================
>
>
>My VFP Traslation
>================
>
>
>DIMENSION proxies(3)
>
>proxies(1)="smtp:uno@uno.com"
>proxies(2)="SMTP:dos@dos.com"
>proxies(3)="smtp:tres@tres.com"
>
>lcString = "smtp:uno@uno.com"+"SMTP:dos@dos.com"+"smtp:tres@tres.com"
>
>objPerson= NEWOBJECT("CDO.person")
>objPerson.DataSource.Open("LDAP://CN=AA0prueba4,CN=Users,DC=redcam,DC=es")
>
>objPerson.EmailAddresses = (@proxies) && Here is the problem
>
>
>objPerson.DataSource.Save
>
>
>================
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform