Re: Exchange Calendar Access & Manipulation
Re: Exchange Calendar Access & Manipulation
- Subject: Re: Exchange Calendar Access & Manipulation
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 08 May 2006 11:26:08 -0700
- Thread-topic: Exchange Calendar Access & Manipulation
On 5/8/06 6:53 AM, "Reese, Stevan" <email@hidden> wrote:
> Entourage 2004 v11.2.3 has an incomplete AppleScript library. You may have
> noticed that you now have a calendar '..On My Computer" and in your Exchange
> account. Addressing these separately is difficult. I'm waiting for the next
> version.....
There are various reasons for the commented lines failing. Several of them
are because you are using incorrect syntax. Answers inline.
>
> The uncommented lines don't fail.
> tell application "Microsoft Entourage"
> get ID of calendar 1
> get ID of calendar 2
> get ID of calendars
> get name of calendars
>
> get category of Exchange calendar 1
> get category of calendars
> get account of Exchange calendar 1
> get kind of Exchange calendar 1
> get kind of calendars
> get URL of Exchange calendar 1
> --get URL of Exchange calendar 2
Although the error only shows up here (due to an implicit coercion, see
below), the problem is that you have not studied the dictionary carefully.
'Exchange calendar' - a class - is not listed as an element of the
application (in Standard Suite). In fact, it i9s not listed as an element of
any class, not even of 'Exchange account'. It is a subclass of 'calendar',
which had to be implemented to allow for all the myriad properties that
don't belong to non-Exchange calendars. But you cannot even compile
Exchange calendars
for example (a plural needs to be implemented by the developers, and this
one has not been, since it would imply that you 'Exchange calendar' is an
element of the application, which it isn't.).
every Exchange calendar
compiles - which it probably shouldn't, but perhaps this is built into
AppleScript. But if you run it, the result is {}, since, once again, there
are no such elements of the application.
Evidently a "user-friendly" implicit coercion was built in by the developers
such that
Exchange calendar 1
is coerced to
calendar 1 of Exchange account 1
which was nice of them, but not required. It (like most "user-friendly"
coercions) unfortunately leads to false assumptions. I'd guess that there
are no coercions for 'Exchange calendar 2' since it isn't clear if that
ought to be
calendar 2 of Exchange account 1
or
calendar 1 of Exchange account 2
or
whatever is the next item of 'every calendar' that happens to be an
Exchange calendar
I suppose they could have implemented the latter but frankly, if you just
use the dictionary and only ask for things in the proper hierarchy of the
application, you'll never go wrong. Simply ask for
calendar 2 of Exchange account 1
if that's what you want, etc. Then you could get
URL of calendar 2 of Exchange account 1
without problem.
> get URL of calendar 1
> get URL of calendar 2
> get URL of calendars
> get category of calendar "Calendar"
> --get name of primary calendar
Two problems here. The first is that, once again, you are asking for
something belonging to
primary calendar
in a plain 'tell application "Microsoft Entourage" ' block - I,.e. directed
to the application. Once again, 'application' in the Standard Suite has no
such 'primary calendar' property. So of course it errors. That's your
mistake. Only 'Exchange account' has a 'primary calendar' property. So this:
get name of primary calendar of Exchange account 1
ought to work, but that fails too, That's because (as I mentioned in my last
email in this thread)
"Note that in the Exchange area of Entourage (i.e. new AppleScript
functionality added in Entourage 2004 or later, which is after the original
AppleScript developer left the Mac Business Unit) there are several cases
where you unfortunately need the explicit 'get' to access elements or
properties of another property - or a variable previously set in an earlier
line ."
Lots of Apple iApps unfortunately require this too (a bad example has been
set by Apple though they've been tidying it up recently). Entourage used
only to have two of these (current messages, and 'selection'). now there are
a lot more. So this works:
get name of (get primary calendar of Exchange account 1)
(Fortunately you don't need a second 'get' for Exchange account 1).
> --get Exchange ID of calendar 1
Again you have not directed this to an Exchange account. 'calendar 1' of the
application is always the local Calendar "On My Computer". The local
calendar is not an Exchange calendar and does not have an Exchange ID, so of
course it errors.
get Exchange ID of calendar 1 of Exchange account 1
_should_ work. However, there seems to be a namespace collision. 'Exchange
ID' actually compiles as 'ExternalID' and errors. It does not compile
outside an Entourage tell block, so its raw code «class "ExID"» doesn't
belong to an osax or basic AppleScript. This is a bug in Entourage, Please
report it via Help/Send Feedback. I'll report it too.
> --get ID of Exchange account calendar 1
Whoa! Now you're in fantasy land. You simply can't just string keywords
together as if any English sentence will work. It compiles OK because these
are all Entourage keywords. But naturally it error on execution since
there's no such things as an 'Exchange account calendar' - where did you get
that?? If you enter the syntax correctly it will work:
get ID of Exchange account 1's calendar 1
get ID of calendar 1 of Exchange account 1
tell Exchange account 1 to get ID of calendar 1
tell Exchange account 1
get ID of calendar 1
end tell
all work because those are all correct AppleScript syntax. 'Exchange account
1' is an element of the application, and 'calendar 1' is an element of that
object. 'Exchange account calendar 1' is not anything that exists in the
AppleScript model, although it may sound like the same thing in English.
perhaps a review of a good AppleScript book, like Matt Neuburg's
"AppleScript: The Definitive Guide" would be in order?
> --get password of Exchange account
This is a special thing not explained by the dictionary. 'password' of any
account (POP, IMAP, Hotmail, Exchange, probably LDAP) can be set but not
got. This is a security feature to prevent scripters hacking into other
people's accounts and getting their passwords, which often are the same as
the passwords for their computer user, etc. It's a 'write only' property.
There's no such official description available, although maybe there's a way
the Entourage developers could somehow tag it so that in Script Debugger it
would appear as 'set' only and not 'get/set' as it does at present.
> end tell
Me too.
--
Paul Berkowitz
_______________________________________________
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