Applescript for Mac Office 2011 - outlook

Is there any Applescript available that sends either an URL or array of images as attachment of the mail through Mac Office 2011?

Also see:
MS Outlook 2011 sp1 V14.1.0 changes the apple script dictionary..
http://www.officeformachelp.com/2011/04/microsoft-updates-applescript-dictionary-for-outlook-2011-sp1/
also:
run send all -- forces mail in out box to be sent right now

Seeing as how Office 2011 is very new, I'd be surprised you'll find ready-made code to use outside of an example script given with Office. This is where the Dictionary comes in; the Dictionary tells you everything that an application responds to, what objects can be manipulated, etc. When scripting an application for the first time, the Dictionary will always be the first thing you look at.
What you are asking doesn't seem like it would be too hard figure out even for someone who is new to Applescript.
UPDATE: Here is teh codez for Entourage 2008. I would imagine that v2011 wouldn't stray too much from this because it is very straightforward:
tell application "Microsoft Entourage"
set newMessage to make new outgoing message with properties {subject:"New Outgoing Message Subject", recipient:"email#domain.com", content:"Message Body", attachment:{pathToFile1, pathToFile2}}
end tell
--> RESULT: A new message appears in the Outbox with the content placed

Related

Custom properties are not being saved immediately to Exchange Server in Outlook desktop 2016

My Outlook web add-in saves emails to an external application.Upon save, it will also write some custom information to exchange server using Office.js's customProps.saveAsync();. So next time the user open the same email, the add-in will look up the properties and if it is not null will remind the user the email has been saved.
Work like a charm in web browser(Office 365).
However in Windows Outlook desktop, the function performs strangely. If I save the email and then immediately move the email to another folder. The customProps.saveAsync(); will fail(nothing saved to exchange server). However, if I re-launch the add-in on the email before moving out to another folder, the custom info will be saved successfully.
Seems to me on Outlook desktop the custom properties will not be written to the exchange server immediately, instead, it will wait until it is being triggered(re-launch add-in etc I do not know the exact mechanism). However, if the email being moved to another folder right after being saved in an add-in, the pending function will be lost.
I found this describing seemingly similar behavior. So I then turned off the "cache" mode in outlook but the problem persisted.
I also tried using EWS's API to perform the "save custom properties", but the problem still persisted.
Am I missing somethinghere or it is Outlook desktop's bug?
You are not missing something - this is definitely a bug in Outlook Desktop. Thank you for reporting the issue. We are investigating and will work on a fix as quickly as we can.
As a workaround in the interim, you can switch messages within the same folder in order to trigger a save. The workaround you found of re-opening an Add-in may also work.

Message box when I receive mail in outlook

I would like to make message pop-up in Autohotkey when there is new message in Outlook. I have tried to use ComObjActive("Outlook.Application") with no joy. Also documentation for COM objects is pretty vague on Autohotkey site. Message should be like msgbox New Mail Received. This is similar to default message pop-up in Outlook. I just need this in AHK.
Main reason is that I'm using Desktops from Sysinternals. This program makes 4 separated desktops. When I run outlook on one desktop, I can't see new message pop-up from outlook on the other desktop. I need a simple AHK script that will tell me when there is a new mail, when I'm on different desktop than the one that is running Outlook.
In the System-StatusBar, their is an icon of outlook, which changes\animates for sometime when a new mail is received.
We can use AutoHotKey > ImageSearch/PixelSearch for the same to find the difference.
Add a SetTimer with ImageSearch/PixelSearch.
Compare and If difference is found >> You Got A Mail.
As Simple As That. If you need futher help with Scripting, Please feel free :)
Hope this Helps :)
I'm not used to AHK but after some research I came up with the following AHK script which should do what you need:
oOutlook = ComObjActive("Outlook.Application")
ComObjConnect(oOutlook, "outlook_")
return
outlook_NewMail() ;uses the COM event NewMail
{
msgbox New Mail Received
oOutlook.Visible := 1 ;make Outlook visible
oOutlook.Activate ;and bring to front
}
To stop listening to the outlook COM events use
ComObjConnect(oOutlook)

Saving MailItem as msg using SaveAs causes Outlook lag

I am writing VSTO Outlook add-in that needs to save some items as msg files. The problem is, each time I call MailItem.SaveAs it causes Outlook to lag slightly and show processing cursor (blue circle).
I have tried moving it int a separate thread, but that does not help.
Saving item is quite fast (less than 100 ms most of the time), but still causes this annoying behavior.
I need to save an item to read it as MSG format, so if I can do this directly this would be even better, but as I found here:
Outlook MailItem as Stream
the only solution seems to use EWS for this. Are there other alternatives?
Maybe using RDO can help in this case?
Another option, as I understand, create msg manually from mail item properties. But maybe there is an easier way?
Unlike OOM, a low level API on which Outlook is based on (Extended MAPI) supports multithreading. So, you can run the code on a secondary thread without any visible impact to the Outlook UI. See INFO: Save Message to MSG Compound File for more information.
Also you may consider using third-party wrappers around Extended MAPI such as Redemption.

Getting a handle to the "CC", "FROM" and "TO" windows in outlook

I am working on an outlook addin in which I need to get a handle to the "CC", "FROM" and "TO" windows in the reading pane.
The approach that was taken in the addin is to use FindWindowEx WIN API and pass in the name as a parameter. But the problem is that the name must be in the UI language that outlook is using.
I am trying to figure a way to get these handles without using the name, but so far no luck. I see that "TO", "FROM" and "CC" are all of the same Class ("Static").
Is there some API which will give me access to these windows without me having to use the name? Or do these windows have some ID which is independent of the language that Oultook is running in.
One constraint is that the addin must work Outlook 2003 and above.
EDIT:
The addin adds a button in the reading pane for each email. When clicked the current email (displayed in the reading pane) is checked and based on its contents somethings are done.
Basically, what you do is NOT use the name, use the hierarchical class name structure.
I.e. the first RichEdit20WPT inside the inspector's rctrl_renwnd32\AfxWndW\AfxWndW#32770 is always the TO: field in. OL2003 and OL2010 have slightly different structures, use any decent windows spying tool to figure it out.

How to detect whether Outlook digitally signs an email by default?

Background:
I'm working on an Outlook addin which adds an attachment to outgoing emails. Support is required for all versions of Outlook.
When a MailItem has been signed with a digital signature, adding an attachment to this mailItem generally fails unless you save the mail item. This removes the signature from mailitem. To me, this is somewhat expected behaviour. Nothing weird here.
The problem is when the user turns digital signatures on (whether through the UI or as a Outlook default behavior) and then turns it off again. The MailItem is no longer signed but it still behaves as if it is -- we're unable to add an attachment to this email.
I found a newsgroup post which might explain why; it appears that objects retrieved through the outlook API aren't the actual objects.
http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.messaging/2006-02/msg00000.html
At the moment, I've given up trying to fix this problem nicely; saving the MailItem to a temporary file appears to fix this however for performance reasons we'd like to only save when a MailItem has transitioned from signed to unsigned. Another acceptable alternative is to detect whether digital signatures has been enabled by default or not. Though there is a registry entry related to the default setting of a digital signature, it is merely a suggestion and does not reflect accurately whether the email would have been signed by default or not.
Any ideas?
You can use redemption api library to call that method from C#.
Also have you tried creating a PInvoke signature from the extended mapi dll?
Turns out that you can use EMAPI in C++ to call IMessagePtr->SaveChanges(), which seems to work quite nicely. Unfortunately, you can't access this in C#.

Resources