<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Outlook &#8211; Blog of Kliment Andreev &#8211; A place so I won&#039;t forget things</title>
	<atom:link href="https://blog.andreev.it/tag/outlook/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.andreev.it</link>
	<description></description>
	<lastBuildDate>Sat, 10 Oct 2020 14:42:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Visual C# : Create Outlook VSTO plugin</title>
		<link>https://blog.andreev.it/2016/03/85-visual-c-create-outlook-vsto-plugin/</link>
					<comments>https://blog.andreev.it/2016/03/85-visual-c-create-outlook-vsto-plugin/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Fri, 18 Mar 2016 14:38:41 +0000</pubDate>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Outlook]]></category>
		<category><![CDATA[plug-in]]></category>
		<category><![CDATA[Visual C#]]></category>
		<guid isPermaLink="false">http://blog.iandreev.com/?p=2501</guid>

					<description><![CDATA[I used Visual C# and MS Office Development Tools to create a VSTO plugin&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>I used Visual C# and MS Office Development Tools to create a VSTO plugin for Outlook. Anytime you receive an email that have the words &#8220;please advise&#8221;, &#8220;please assist&#8221; or &#8220;kindly&#8221;, you&#8217;ll see a red banner in the email.</p>
<p>As Urban Dictionary says, please advise is &#8220;<em>an extremely stuffy phrase used by business executives to close emails when they don&#8217;t understand how to ask a real question. It basically means Please use your imagination to figure out what the f* I need to know to make a decision on this item without making me look like an idiot in front of all the people I CCed&#8221;</em></p>
<pre class="brush: plain; title: ; notranslate">
Dear Luke,

I recently got a call from Alex in LA telling me that we're out of blinkity blank in California so the blippity blue isn't working. 
What-the-f* we're losing 15k a day what-the-f* save me please.

Please Advise, 
John
</pre>
<p>So&#8230;. Go to Visual Studio, choose a new Project and select Outlook. I did mine for Outlook 2010, but it should be very similar for 2013 and 2016.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2016/03/P064-01.png"><img fetchpriority="high" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2016/03/P064-01.png" alt="" width="955" height="660" class="aligncenter size-full wp-image-7469" srcset="https://blog.andreev.it/wp-content/uploads/2016/03/P064-01.png 955w, https://blog.andreev.it/wp-content/uploads/2016/03/P064-01-300x207.png 300w, https://blog.andreev.it/wp-content/uploads/2016/03/P064-01-768x531.png 768w, https://blog.andreev.it/wp-content/uploads/2016/03/P064-01-585x404.png 585w" sizes="(max-width: 955px) 100vw, 955px" /></a><br />
Once you have the template, update the methods, so it looks like the source below. Change the list of words if you like (line 29), then compile and run and the add-in will be automatically added to Outlook. If you want to distribute it, it&#8217;s a bit more complicated, but check this <a href="https://msdn.microsoft.com/en-us/library/cc442767.aspx" target="_blank" rel="noopener noreferrer">page</a> or this <a href="https://blogs.msdn.microsoft.com/emeamsgdev/2013/11/21/outlook-deploying-an-outlook-2013-add-in-using-installshield-le/" target="_blank" rel="noopener noreferrer">page</a>. </p>
<p>If everything is OK, next time you receive an e-mail it will look like this.<a href="https://blog.andreev.it/wp-content/uploads/2016/03/P064-02.png"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2016/03/P064-02.png" alt="" width="1057" height="324" class="aligncenter size-full wp-image-7470" srcset="https://blog.andreev.it/wp-content/uploads/2016/03/P064-02.png 1057w, https://blog.andreev.it/wp-content/uploads/2016/03/P064-02-300x92.png 300w, https://blog.andreev.it/wp-content/uploads/2016/03/P064-02-1024x314.png 1024w, https://blog.andreev.it/wp-content/uploads/2016/03/P064-02-768x235.png 768w, https://blog.andreev.it/wp-content/uploads/2016/03/P064-02-585x179.png 585w" sizes="(max-width: 1057px) 100vw, 1057px" /></a></p>
<pre class="brush: cpp; title: ; notranslate">
using System.Collections.Generic;
using System.Linq;
using Outlook = Microsoft.Office.Interop.Outlook;

namespace PleaseAdvise
{
    public partial class ThisAddIn
    {

        Outlook.NameSpace outlookNameSpace;
        Outlook.MAPIFolder inbox;
        Outlook.Items items;

        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            outlookNameSpace = this.Application.GetNamespace(&quot;MAPI&quot;);
            inbox = outlookNameSpace.GetDefaultFolder(
                    Microsoft.Office.Interop.Outlook.
                    OlDefaultFolders.olFolderInbox);

            items = inbox.Items;
            items.ItemAdd +=
                new Outlook.ItemsEvents_ItemAddEventHandler(items_ItemAdd);
  
        }

        void items_ItemAdd(object Item)
        {            
            List&lt;string&gt; lstKeyWords = new List&lt;string&gt;(new string&#x5B;] { &quot;PLEASE ADVISE&quot;, &quot;PLEASE ASSIST&quot;, &quot;KINDLY&quot; });
            Outlook.MailItem mail = (Outlook.MailItem)Item;
            if (Item != null)
            {
                bool bSubject = lstKeyWords.Any(mail.Subject.ToUpper().Contains);
                bool bBody = lstKeyWords.Any(mail.Body.ToUpper().Contains);
              
                if ((mail.MessageClass == &quot;IPM.Note&quot;) &amp;&amp; (bSubject || bBody))
                {
                    mail.FlagIcon = Outlook.OlFlagIcon.olRedFlagIcon;
                }
            }
        }
    
        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
            // Note: Outlook no longer raises this event. If you have code that 
            //    must run when Outlook shuts down, see http://go.microsoft.com/fwlink/?LinkId=506785
        }

        #region VSTO generated code

        /// &lt;summary&gt;
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// &lt;/summary&gt;
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }
        
        #endregion
    }
}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2016/03/85-visual-c-create-outlook-vsto-plugin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
