[python-win32] How to create a vbArray of Strings in python for
win32
Aaron Patrick Lehmann
lehmanap at cs.purdue.edu
Tue Mar 16 13:46:25 EST 2004
Hello--
I'm trying to create and edit Exchange contacts using Python for win32. In
Exchange, the contacts each have a list of contacts, so that I know who my
contacts know. This list is represented as an array of Strings. When I view
one that I have already made, Python converts this to a tuple of unicode
strings. I have tried, but I can't seem to make it convert back. Follows is
the relevant snippet of code to link to contacts. Could someone point out what
I'm doing wrong, or possibly provide an example of how to make and use an array
in python for win32?
CdoPR_CONTACTS = 0x817C001EL#will yeild a tuple of the names of a contacts contacts
vbArray = 8192L
vbString = 8L
STRING_AR = vbArray + vbString
def _linkContacts( con1, con2 ):
"""
Arguments:
con1 -- A Contact Message from an Exchange server
con2 -- Another Contact message from the Exchange server
"""
con1Fields = con1.Fields
try:
#Try to add the second contacts name to the first contacts list, as though we
#know it is there
con1cons = con1Fields.Item( CdoPR_CONTACTS )
if con2.Subject not in con1cons.Value:
con1cons.Value = con1cons.Value + ( con2.Subject, )
except:
#If it wasn't there, then create it, with the appropriate starting value
con1Fields.Add( CdoPR_CONTACTS, STRING_AR, ( con2.Subject, ) )
#update the contact in Excahnge
con1.Update( )
Aaron Lehmann
--
Old hold for new construction. --Gene Ray www.timecube.com
More information about the Python-win32
mailing list