I am creating my first Addin for Outlook 2010, it's for using emojis that are added to the email body when a button on the custom ribbon is pressed.
I currently have it so that when a button is pressed the corresponding emoji is added to the end of the email.
My main issue is that I don't want to just add the emoji at the end of the HTMLBody but at the current location of the cursor, is there any way to do this with Outlook 2010?
I tried using this tutorial.
However any use of Application.Selection gives me an error cs1061: "Application does not contain a definition for Selection...", I'm assuming that this is because I'm using Outlook 2010 and not Outlook 2013 or later but correct me if I'm wrong.
All and any help is greatly appreciated.
Application.Selection refers to the Word Object Model, but you are using Outlook's Application. What you need is Application.ActiveInspector.WordEditor.Application.Selection (where Application.ActiveInspector.WordEditor in OOM returns the Document Word Object Model object corresponding to the editor window of the active Outlook inspector).
Related
Good Morning,
Since a few days, I'm searching for an opportunity to change colours in Outlook by VSTO (Visual Studio Tools for Office - C#).
I would like to change the colour of the recipient, which I write down when I would like to send an e-mail.
Is that even possible?
I don't find anything on the web about that, but it would be the best solution for my project.
The Outlook extensibility model doesn't provide anything for customizing the Outlook UI, i.e. changing colors of the recipients.
The best what you could do is to use the ContactItem.Categories property which allows setting a string representing the categories assigned to the Outlook item.
Categories is a delimited string of category names that have been assigned to an Outlook item. This property uses the character specified in the value name, sList, under HKEY_CURRENT_USER\Control Panel\International in the Windows registry, as the delimiter for multiple categories.
I have a pretty specific problem, maybe some of you have an idea..
I'm making a VSTO AddIn for outlook, and I managed to show a formregion - first with registry entries, than I figured it out, that I can define with the "Form region Wizard" - on specific Items (like Appointment, Meeting item etc.) but I cannot find a way to show the formregion on undeliverable message item, sent by System Administrator.
Any Suggestions? Which Item could it be?
Thanks.
Each item in Outlook has a message class associated with it. In your scenario you deal with a ReportItem. Here is what MSDN states for that object:
The ReportItem object is similar to a MailItem object, and it contains a report (usually the non-delivery report) or error message from the mail transport system. Unlike other Microsoft Outlook objects, you cannot create this object. Report items are created automatically when any report or error in general is received from the mail transport system.
And the form region is usually associated with a particular message class. The report item has the REPORT.IPM.Note.NDR string for the message class. It seems you just need to specify the right message class for your form region.
I am having an issue with an AddIn I am building.
I want to get only the ATTACHMENT appended to a mail.
However :
Mail.Attachment also includes the pictures or logos in the mail content.
You need to check out the following Extended MAPI properties, use PropertyAccessor.GetProperty for that:
PR_ATTACH_CONTENT_ID, DASL name: "http://schemas.microsoft.com/mapi/proptag/0x3712001F"
PR_ATTACHMENT_HIDDEN, DASL name: "http://schemas.microsoft.com/mapi/proptag/0x7FFE000B"
Take a look at the similar question - Distinguish visible and invisible attachments with Outlook VBA for more informaton and sample code.
I'm currently working on add in to outlook but face a problem my requirement is to add feature that is similar to spell checking (program will underline some of the text in real time). Is that even possible in vsto ? any material is appreciated i've searched for answer online - without any success
The integration you need would not be with VSTO or the Outlook Object Model, but rather mainly with the Word Object Model (WOM). Outlook users Word to render HTML formatted messages and provides access to the email as if it is a Word document, via the Inspector.WordEditor property which returns a Word.Document object.
So you can use WOM to format the body content as you see fit. However, there are no real-time events for hooking into changes of the message body as they occur. You will need to use either timers or low-level keyboard hooks to capture the changes that the user is making.
I have searched for my problem and couldn't find any answer to it. There are similar questions to this, but not specifically mine. Any help or suggestion is appreciated.
I am working on an outlook add-in using C# (vs 2010). I will need to parse all of the "Received:" lines out of the header. Currently I am testing this on Outlook 2010.
By default, outlook will strip the header and keeps only what it needs. So no matter how to configure it, it will strip the header and if there are say 4 "Received" lines in the header, Outlook only keeps the last one.
Following the registry modification explained here, will partially solve the problem as it will retain the header only when Outlook is set to POP3. IMAP still has all of the "Received:" lines removed (except the last one).
The following is how I am getting the header using C# (this is part of a code that is called every time an email is selected in outlook):
const string PR_MAIL_HEADER_TAG = #"http://schemas.microsoft.com/mapi/proptag/0x007D001E";
Object selObject = this.Application.ActiveExplorer().Selection[1];
Outlook.MailItem mailItem = (selObject as Outlook.MailItem);
Outlook.PropertyAccessor oPA = mailItem.PropertyAccessor as Outlook.PropertyAccessor;
string Header = (string)oPA.GetProperty(PR_MAIL_HEADER_TAG);
This will give me the header, but only what Outlook has kept, nothing from the original email.
To clarify, opening the email and choosing File -> Properties -> Internet Header also only shows what is left from the header after outlook's modifications, not the original one.
The outlook option -> Action -> Other actions -> View Source also does not reveal what I am looking for.
So I am basically looking for a way to read IMAP original email source using within C#.