Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Is it possible to read Outlook Exchange Calendar?


  • Please log in to reply
5 replies to this topic
Firewolf91
  • Members
  • 137 posts
  • Last active: Apr 08 2014 08:43 PM
  • Joined: 19 Oct 2007
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

Firewolf91
  • Members
  • 137 posts
  • Last active: Apr 08 2014 08:43 PM
  • Joined: 19 Oct 2007
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.

closed
  • Members
  • 509 posts
  • Last active: Jan 14 2012 06:14 PM
  • Joined: 07 Feb 2008
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

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



Firewolf91
  • Members
  • 137 posts
  • Last active: Apr 08 2014 08:43 PM
  • Joined: 19 Oct 2007
I will definitely look into that, thanks for the reply!

Firewolf91
  • Members
  • 137 posts
  • Last active: Apr 08 2014 08:43 PM
  • Joined: 19 Oct 2007
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?

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
"Easiest" would indeed be to search for a VB script (there are numerous on the internet), and translate it using the COM library.

Example:
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