Re: Accessing Exchange InBox in Entourage
Re: Accessing Exchange InBox in Entourage
- Subject: Re: Accessing Exchange InBox in Entourage
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 04 Nov 2005 12:25:25 -0800
- Thread-topic: Accessing Exchange InBox in Entourage
Have you looked at the Entourage AppleScript dictionary? And which version
of Entourage - the latest upgrade, SP 2, added a lot of AppleScript
properties to Exchange accounts. (Back in Entourage 10.1.4, when Exchange
accounts were first created, there was no property for its inbox, but there
were ways of getting it by treating it as an IMAP account - or just use
'folder 1'. I can't recall if Entourage 2004 11.0 had the property yet, or
not.)
In Entourage 11.2 (SP 2) , at least, the dictionary shows the 'inbox folder'
property of Exchange account. But do not assume that your Exchange account
has an id of 1 (unless you know by experiment it does). Account ID numbers
are "shared" by all types of accounts, so id 1 might be a POP or IMAP
account if you created that first, and your Exchange account would have a
different id. Also, if you ever have to delete and remake the account, it
will get a new ID. So it's better to refer to it as 'Exchange account 1'. or
by its name. So this _should_ work:
set theList to every message of (the inbox folder of Exchange account 1)
But you'll discover that although it des not error, you get an empty list
{}. That's because the Entourage developers did not implement this
AppleScript property well (but they're in good company: all the Apple
developers of the scriptable iApps have done the same with _every_
property). You need to first evaluate the inner property (the inbox folder)
by either a variable on a separate line, or by using the explicit 'get' if
you do it in one line. It's too bad they didn't catch this - it makes using
AppleScript much less "English-like". U until now there were only two
properties in all of Entourage that needed this treatment - 'selection' and
'current messages'. But here's another - and I'd bet more have been added
too. An empty list is worse than erroring - you have no idea anything's
wrong.
(And don't set the same variable theList to two different lists of messages
- the second time just "wipes out" the first time.)
tell application "Microsoft Entourage"
set theList to every message of (get the inbox folder of Exchange
account 1)
You shouldn't really need to coerce thisSubject to string - unless you know
that FileMaker can't handle Unicode text? (And same with thisContent.)
It's not considered good style to put a FileMaker (or other app's) tell
block inside an Entourage (or other app's) tell block, but it won't stop it
working. (The alternative is to call a subroutine to do the FMP part.)
--
Paul Berkowitz
> From: Tim Cimbura <email@hidden>
> Reply-To: <email@hidden>
> Date: Fri, 4 Nov 2005 12:42:16 -0700
> To: <email@hidden>
> Subject: Accessing Exchange InBox in Entourage
>
> I'm creating a script that looks at messages in Entourage and creates records
> in a FileMaker database after filtering them.
>
>
>
> I'm not able to get the syntax correct for accessing the InBox for an Exchange
> account. Can anyone help?
>
>
>
> Here's what I've got so far...
>
>
>
> tell application "Microsoft Entourage"
>
>
>
> set theList to every message of folder "InBox" -- This line works fine
>
> -- The following line fails to work
>
> -- Microsoft Entourage got an error: Can't get every message of inbox folder
> of Exchange account id 1.
>
> set theList to every message of (the inbox folder of Exchange account id 1)
>
>
>
> repeat with aMsg in theList
>
>
>
> set thisSubject to (subject of aMsg) as string
>
> if thisSubject contains ":" then
>
>
>
> tell me to display dialog thisSubject
>
> set thisText to (content of aMsg) as string
>
>
>
> tell application "FileMaker Pro Advanced"
>
> tell database "TestMe"
>
> set thisRecord to create new record of table "TestMe"
>
> set cell "Text" of thisRecord to thisText
>
> set cell "Subject" of thisRecord to thisSubject
>
> end tell
>
> end tell
>
> end if
>
>
>
> end repeat
>
> end tell
>
>
>
> --------------------------
>
> Tim Cimbura
>
> 16488 - 83rd Ave N
>
> Maple Grove, MN 55311-1846
>
> 763-420-7083
>
> 612-298-0086 Mobile
>
> email@hidden
>
> http://www.cimbura.com
>
>
>
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Applescript-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden