Hi There,

I believe there may be a bug in Office 2011 Mac Outlook when creating calendar events via applescript. I have submitted this as a "feedback" to the team, however it clearly states that they won't be able to give me any personal response.

Here is my applescript:
<code>

(*

Create Event from Message

Copyright (c) Microsoft Corporation.  All rights reserved.

*)


tell application "Microsoft Outlook"

-- set the folder name which we will move the email to after

set DestFolderName to "2-Defer"

-- get the currently selected message or messages

set selectedMessages to current messages

-- if there are no messages selected, warn the user and then quit

if selectedMessages is {} then

display dialog "Please select a message first and then run this 

script." with icon 1

return

end if

repeat with theMessage in selectedMessages

set category of theMessage to {category "@defer"}

-- get the information from the message, and store it in variables

set theName to subject of theMessage

set theCategory to category of theMessage

set theContent to content of theMessage

set theDate to current date

set time of theDate to (9 * 60 * 60)

set nextWeekStart to theDate + (24 * 60 * 60 * 7)

-- create a new note with the information from the message

set newEvent to make new calendar event with properties {subject:theName, category:theCategory,content:theContent, all day flag:true, has reminder:true, reminder time:5, free busy status:free, start time:nextWeekStart, end time:nextWeekStart, is private:true}

-- move the message to the defer folder

set theAccount to account of theMessage

set theFolder to folder DestFolderName of folder "Inbox" of theAccount

move theMessage to theFolder

end repeat

-- if there was only one message selected, then open that new note

if (count of selectedMessages) = 1 then open newEvent

end tell

</code>

I'm creating an all day event 1 week in the future at 9:00AM. Since it is an all day event, I have simply kept the start and end times the same (although the bug also occurs if end time is different to start time.

On running the script, the event is created fine, however in the end time field on the calendar event, the date always appears as 1 day older than the start time. e.g. if the start time is set as "13/01/2013 09:00" the this will produce an event with start time field "13/01/2013 09:00" and end time field "12/01/2013 09:00". The all day box is ticked (as expected) and the duration label is correct (in my example "0 minutes").

So the question is, how do I correctly set the end date of an all day event? does the end date matter?! Is it a bug with applescript in outlook?

Thanks,

Dan

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.