AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is it possible to read Outlook Exchange Calendar?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Firewolf91



Joined: 19 Oct 2007
Posts: 134
Location: PA

PostPosted: Wed Dec 31, 2008 6:33 pm    Post subject: Is it possible to read Outlook Exchange Calendar? Reply with quote

I did a couple quick searches and did not see anything on this...We use Outlook 2003.

I have an application I'm working on at work that randomly generates assignments each day to my team of 16 people. 11 assignments for 16 possibilities. Some days, obviously, people are on vacation or sick, etc. and some people don't work Mon-Fri, so we don't always have 16.
I have a separate module that my supervisor can use to setup each employee's weekly schedule - i.e. Jack works Mon-Fri, Tim works Tue-Fri.
The random generator works fine. My fallback is with Outlook 2003 Calendar.

What I need is to be able to read the Calendar (basically, convert the "appointment" data to text and parse it). Once I can get that data to a form I can work with, I can do what I need to do...but I don't know how to search the Calendar and grab that data using AHK. Is it possible? Am I being clear here?


Example:
Fred works Mon-Fri. He requested off for vacation on Thu and Fri. His manager enters this into the calendar for Thu and Fri: Fred - Vacation.

-- If it is possible to read the Calendar, I would have my manager & supervisor put an indicator on the entries for our team. i.e. "&& Fred - Vacation." so that I can search for the &&.

Also, another good reason for this is that once the assignment schedule is created, if there are any modifications to the Outlook Calendar (i.e. call-outs), I can have it notify whoever is the backup for that day that an assignment needs to be reassigned.


Thanks!!

- Gavin/Firewolf


Last edited by Firewolf91 on Fri Jan 02, 2009 7:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
Firewolf91



Joined: 19 Oct 2007
Posts: 134
Location: PA

PostPosted: Wed Dec 31, 2008 7:05 pm    Post subject: Reply with quote

I'm assuming I might have to use COM objects (and learn how to use them) to accomplish what I'm asking here. Since I don't really know much on COM objects, I'm not sure if that's what is needed here.
Back to top
View user's profile Send private message
closed



Joined: 07 Feb 2008
Posts: 509

PostPosted: Wed Dec 31, 2008 7:34 pm    Post subject: Reply with quote

i am not familiar with outlook but if you can export the calendar as ics file format you can use ahk to parse the data

see wikipedia for ics format,this is an example of one entry in a calendar in icalendar export format
Quote:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
DTSTART:19970714T170000Z
DTEND:19970715T035959Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR
Back to top
View user's profile Send private message
Firewolf91



Joined: 19 Oct 2007
Posts: 134
Location: PA

PostPosted: Wed Dec 31, 2008 7:48 pm    Post subject: Reply with quote

I will definitely look into that, thanks for the reply!
Back to top
View user's profile Send private message
Firewolf91



Joined: 19 Oct 2007
Posts: 134
Location: PA

PostPosted: Fri Jan 02, 2009 6:45 pm    Post subject: Reply with quote

Ok, I know it's possible to export as an ICS file, but not sure if Outlook 2003 does it? All I saw was import ICS file, no export. Under Calendar, "Save as web page" was the only option - which saves the calendar as a bunch of files that I don't need.

I need
1. an automated process that will pull data (Multiple times per day) from the Shared Calendar

2. to be able to parse this data (I can figure out the parsing once the data is pulled off the Calendar)

3. so I can update my application with current schedule data.


Is this feasible? Is there an easier way to get the data down to a usable format for my AHK application?
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Fri Jan 02, 2009 9:57 pm    Post subject: Reply with quote

"Easiest" would indeed be to search for a VB script (there are numerous on the internet), and translate it using the COM library.

Example:
Code:
In general terms here's the code for manipulating an appointment in a calendar folder.  Since you weren't specific about what you need I've shown how to open a calendar folder, loop through the entries in a calendar, and add an appointment to a calendar.

    'In your project include a reference to Microsoft Outlook x.x Object Library
    'where x.x is your version of Outlook
    Dim objApp As Outlook.Application, _
        objNS As Outlook.NameSpace, _
        objCalendar As Outlook.MAPIFolder, _
        objAppointment As Outlook.AppointmentItem
    Set objApp = CreateObject("Outlook.Application")
    Set objNS = objApp.GetNamespace("MAPI")
    'Change OutlookProfileName to the name of your Outlook profile
    objNS.Logon "OutlookProfielName"
    Set objCalendar = objNS.GetDefaultFolder(olFolderCalendar)
   
    'To access each appointment in the calendar do this
    For Each objAppointment In objCalendar.Items
        'Code to do whatever you want to do with each appointment
    Next
   
    'To add an appointment do this
    Set objAppointment = objApp.CreateItem(olAppointmentItem)
    With objAppointment
        .Body = "Some text"
        .BusyStatus = olBusy
        .Start = #6/9/2005 6:00:00 AM#
        .Duration = 60
        .Subject = "My Appointment"
        .Save
    End With


HTH
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group