It's possible, but it needs an ugly hack to work round what I suspect is a
bug in Entourage.
tell application "Microsoft Entourage"
set theAccount to first Exchange account
set favFolder to favorites folder of theAccount
set theDestination to folder 1 of favFolder
set newPost to make new outgoing message at end of theDestination with ¬
properties {subject:"Test Post", Exchange post:true}
move newPost to theDestination
end tell
If you tell Entourage to 'make new post' anywhere but an exchange folder,
the script errors, saying posts have to be made in an exchange folder, but
the post is created in the local Drafts folder! (so, the error message is
lying <g>)
That is why I make the post at the end of 'thedestination', and then
immediately move it into 'thedestination'
All other properties of the post, including attachments can be made in the
normal way.
Well, this is fascinating, Barry. I have discovered a few issues, however:
1) You can, instead, forget about the 'Exchange post:true' property, and
leave out 'at end of' anywhere, and do this:
set newPost to make new outgoing message with properties {subject:"Test
Post 1", content:"Test 1"}
move newPost to theDestination
That gets the post there, too: the only thing it's missing is the cute icon
for Exchange posts. (If you include 'Exchange post:true', you get the error
about having to make Exchange posts only in an Exchange folder.) When you do
it this way, the message appears in the public folder, as it should, bolded
(as unread) and correctly sorted when viewed by Received order (the
default). But see below.
2) When you do it your way, with 'Exchange post:true' to get the icon, then
it does indeed need to be made 'at end of' (or 'at beginning of' - that also
works) some Exchange folder, then moved. (Deep down, all new elements
require insertion at a "location". But good developers implement it do you
don't need to specify 'at end' or 'at beginning': in Entourage, it's never
necessary. Thus this looks like they never intended to facilitate posting to
public folders - it's probably a hack that it works at all. It's also a
"bug", or "feature gap" anyway, that it was not implemented properly.)
The trouble is : the message appears at the very bottom of the list, not the
top, when viewed in Received order, and as soon as the public folder updates
(syncs) with the server, it appears unbolded, as read. (If you don't have
the public folder selected as you run the script, and only go to it
afterwards, you'll see this for yourself. Or else move away and back to the
folder, or do a "Synchronize Now" on it.) So you won't notice that you've
got a new message.
If you check for 'time received' of this message, you'll see there is none
(in AppleScript, it will show as Jan. 1, 1904). This makes sense, since it
was never received in the normal way.
You _could_ get around this by making it an _incoming_ message instead of an
outgoing one. But then you'd have to specify all sorts of things, like the
sender (you). This would get very "iffy", and not comfortable, However, if
you try it, you'll see the message does appear bolded, correctly sorted. It
just doesn't have a sender!
3) Finally, I'm curious to know if any or all of these methods create
messages that are seen by other people on the Exchange server, or if any of
them might not sync to the server. Also, the posts that display in a
less-than-ideal way (no Received time, sorted wrong, viewed as read) may
appear just fine on other computers where in fact they are properly
"received".
Barry, could you please check the BetaFriends public folder you have in
Mailing List Archives folder in Public Folders of our mbubeta Exchange
account, and see if my posts appear there? They're all called "Test Post x",
numbered 1 through 7 (not "x"). Please sort the folder by Received. In my
own case only numbers 1 and 4 are sorted correctly - with Test Post 1 as a
"regular" email icon rather than Exchange, and Test Post 4 appearing without
a sender. Nos. 2, 3, 5, 6, 7 all have the correct Sent time but are at the
wrong end when sorted by Received, and on my computer all appear as Read
although they aren't read yet. On your computer, if you can see them at all,
they might all appear correctly, which would be great if so.
--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <
http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <
http://macscripter.net/scriptbuilders/>
Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.
PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.