(*
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
Recent Comments