Outlook outgoing message id

Hi there,

I would like to get the Outlook message id of a message that’s currently being composed. When I have finished composing an email I would like to run a script that closes the message, saving it into the drafts folder and returning that messages id so that I can refer back to it later. The problem that I’m having is trying to get the id of a message that’s still being composed.

This is the second part of the script that gives me the message id of a draft message:

tell application "Microsoft Outlook"
	set draftsFoldersList to every mail folder whose name is "Drafts"
	repeat with thisDraftFolder in draftsFoldersList
		set messageCount to count of messages of thisDraftFolder
		if messageCount > 0 then
			repeat with i from 1 to count of messages of thisDraftFolder
				set thisMessage to message i of thisDraftFolder
				set messageProps to properties of thisMessage
				set messageid to id of messageProps
			end repeat
		end if
	end repeat
end tell

I tried this:

tell application "Microsoft Outlook"
	set messageProps to properties of window 1
	set messageid to id of messageProps
	close window 1 saving yes
end tell

but it only gives me the window id not the message.

Any ideas would be appreciated.

Thanks,
Nik

Hi Nik,

If I execute the following code in Script Debugger I get a ‘draft window id’ property and an ‘id’ property.

tell application "Microsoft Outlook"
	activate
	set theWindow to window 1
	get properties of theWindow
end tell

Does a ‘message id’ get assigned once the message is closed and saved?

Hi,

thanks for looking but I’m afraid you might be right, a message id is only assigned once it’s closed and saved. The window id becomes irrelevant once the window is closed.

Thanks,
Nik