get category name of entourage message

i’m trying to get the name of the category of each message in a mailbox…


tell application "Microsoft Entourage"
	set theMessages to (messages of folder "test" in folder "inbox" of Exchange account id 1)
	repeat with i in theMessages
		set theCategory to (category of i)
		set categoryName to name of theCategory
	end repeat
end tell

above returns a valid category ID (as class cCtg) - in the event window it shows as {category id 19} for the test message i have.

however, the set categoryName line fails saying “Can’t get name of {category id 19 of application “Microsoft Entourage”}.”

interestingly, if i change the line to

  • it works and returns the correct name.

I’ve tried to coerce the “set theCategory…” line by using “as text” or “as unicode text” or “as string”, but it won’t let me… tells me it can’t do that (“Can’t make «class cCtg» id 19 of application “Microsoft Entourage” into type Unicode text.”)

i though i’d even try and put theCategory on the clipboard and write a shell script command to parse out what i need - but the clipboard is empty when try and set it to theCategory!

any idea how to coerce theCategory to the proper format to extract it’s name or otherwise get at the name?

thanks, jay

:slight_smile:
answering my own post - i guess reading the dictionary more closely helps…

category property is a list, so the following works:


tell application "Microsoft Entourage"
	set theMessages to (messages of folder "test" in folder "inbox" of Exchange account id 1)
	repeat with i in theMessages
		set categoryName to name of item 1 of (category of i as list)
	end repeat
end tell