[python-win32] how to get access to someone's else Outlook Calendar ?
Stef Mientki
stef.mientki at gmail.com
Mon May 3 22:40:27 CEST 2010
On 29-04-2010 09:08, Mark Hammond wrote:
> IIRC, the outlook application doesn't support a Logon. Your best bet
> is probably to try and find some examples in VBScript or any other
> language and then translate the knowledge that gives you into Python.
thanks Mark,
that was a very good hint.
I found this VB script:
http://www.outlookcode.com/codedetail.aspx?id=43
rewritten into Python (see code below, needs some refactoring), works
great !!
Now one small question, how do I get those constants, like
constants.olFolderCalendar (=9) ?
thanks,
Stef Mientki
outlook = win32com.client.Dispatch("Outlook.Application")
namespace = outlook.GetNamespace("MAPI")
print dir(constants)
Item = outlook.CreateItem ( 1 ) #constants.olAppointmentItem ) #olMailItem)
Recip = Item.Recipients.Add ( 'Klaasen, Jan' ) # <== this is not me,
but some other !!
Recip.Resolve ()
if Recip.Resolved :
Folder = namespace.GetSharedDefaultFolder ( Recip, 9 )
#constants.olFolderCalendar )
print Folder
afspraken = Folder.Items
afspraken.Sort("[Start]")
##afspraken.IncludeRecurrences = "True"
#Possible columns are Subject, Location, Start, End, Recurrence
Pattern, Categories
afspraak = afspraken.GetFirst()
while afspraak:
start = datetime.datetime.fromtimestamp (int (afspraak.Start))
subject = afspraak.Subject.encode("utf-8")
print '===', start, subject
afspraak = afspraken.GetNext()
if start.year >2011: #nextYear:
#avoid to loop until 2038 :-)
break
>
> HTH,
>
> Mark
>
> On 29/04/2010 5:34 AM, Stef Mientki wrote:
>> hello,
>>
>> I want to control a number Outlook Calendars from different persons,
>> and I have access privilges and can manipulate them through Outlook.
>> Now I want to control them through Python.
More information about the python-win32
mailing list