[python-win32] problem w/ outlook scripting
Michael Katz-Hyman
mkatshym+pythonwin32 at gmail.com
Thu Mar 16 15:32:20 CET 2006
I have the below script to play around with contact lists in outlook. When
it runs, I get a popup in outlook asking me if i want to gve the script
access, I say yes, it seesm to run okay, but no new distribution list in my
contact folder is created. I have very similar VBA code which runs just
fine as a macro and creates the list, any ideas? Thanks! -Michael
import win32com.client
import sys, os
myOlApp = win32com.client.Dispatch("Outlook.Application")
myNameSpace = myOlApp.GetNamespace("MAPI")
myDistList = myOlApp.CreateItem(
win32com.client.constants.olDistributionListItem )
myTempItem = myOlApp.CreateItem(win32com.client.constants.olMailItem)
myRecipients = myTempItem.Recipients
myDistList.DLName = "Test"
myRecipients.Add("(Test Name) ghe at stimd.org")
myRecipients.ResolveAll
myDistList.AddMembers(myRecipients)
myTempItem2 = myOlApp.CreateItem(win32com.client.constants.olMailItem)
myRecipients2 = myTempItem2.Recipients
myRecipients2.Add ("(Mr. Vlarg) vlarg at poop.org")
myRecipients2.ResolveAll
myDistList.AddMembers(myRecipients2)
myTempItem3 = myOlApp.CreateItem(win32com.client.constants.olMailItem )
myRecipients3 = myTempItem3.Recipients
myRecipients3.Add("ghe at stimd.org")
myRecipients3.ResolveAll
myDistList.RemoveMembers(myRecipients3)
myDistList.Save
myDistList.Display
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20060316/c02b02ee/attachment.htm
More information about the Python-win32
mailing list