<?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>Sytone&#039;s Ramblings &#187; c#</title>
	<atom:link href="http://www.sytone.com/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sytone.com</link>
	<description>Me, Family, Life</description>
	<lastBuildDate>Wed, 08 Sep 2010 15:53:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WPF Converter: CaseConverter</title>
		<link>http://www.sytone.com/2010/08/wpf-converter-caseconverter/</link>
		<comments>http://www.sytone.com/2010/08/wpf-converter-caseconverter/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 06:53:35 +0000</pubDate>
		<dc:creator>Sytone</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Binding]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.sytone.com/?p=256</guid>
		<description><![CDATA[<p>Case Converter was made when I wanted the text to display in a WPF UI in upper case. Probably not the best class name, but anyway. To get the code and install read on.</p> <p></p> <p>Make any UI string uppercase. Once you have registered the resource and created the class just use the converter [...]]]></description>
			<content:encoded><![CDATA[<p>Case Converter was made when I wanted the text to display in a WPF UI in upper case. Probably not the best class name, but anyway. To get the code and install read on.</p>
<p><span id="more-256"></span></p>
<p>Make any UI string uppercase. Once you have registered the resource and created the class just use the converter in the element you want converted.</p>
<pre>&lt;TextBlock Text="{Binding Title, Converter={StaticResource CaseConverter}}"/&gt;</pre>
<p>Add the following element to the XAML, usually in Window.Resources and ensure that you have registered your namespace for local to the namespace of your application. e.g. <em>xmlns:local=&#8221;clr-namespace:ExampleApp&#8221;</em></p>
<pre>&lt;local:CaseConverter x:Key="CaseConverter" /&gt;</pre>
<p>This is the class, short and sweet.</p>
<pre class="brush:csharp">    public class CaseConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string text = value as string;
            if(text != null)
            {
                return text.ToUpper(culture);
            }

            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
        }
    }</pre>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=WPF+Converter%3A+CaseConverter+-+http://b2l.me/apbd6x&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://www.sytone.com/2010/08/wpf-converter-caseconverter/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.sytone.com/2010/08/wpf-converter-caseconverter/&amp;title=WPF+Converter%3A+CaseConverter" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.sytone.com/2010/08/wpf-converter-caseconverter/&amp;title=WPF+Converter%3A+CaseConverter" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-diigo">
			<a href="http://www.diigo.com/post?url=http://www.sytone.com/2010/08/wpf-converter-caseconverter/&amp;title=WPF+Converter%3A+CaseConverter&amp;desc=Case%20Converter%20was%20made%20when%20I%20wanted%20the%20text%20to%20display%20in%20a%20WPF%20UI%20in%20upper%20case.%20Probably%20not%20the%20best%20class%20name%2C%20but%20anyway.%20To%20get%20the%20code%20and%20install%20read%20on.%0D%0A%0D%0A%0D%0A%0D%0AMake%20any%20UI%20string%20uppercase.%20Once%20you%20have%20registered%20the%20resource%20and%20created%20the%20class%20just%20use%20the%20converter%20in%20the%20eleme" rel="nofollow" class="external" title="Post this on Diigo">Post this on Diigo</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.sytone.com/2010/08/wpf-converter-caseconverter/&amp;t=WPF+Converter%3A+CaseConverter" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-hotmail">
			<a href="http://mail.live.com/?rru=compose?subject=WPF+Converter%3A+CaseConverter&amp;body=Link: http://www.sytone.com/2010/08/wpf-converter-caseconverter/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A Case%20Converter%20was%20made%20when%20I%20wanted%20the%20text%20to%20display%20in%20a%20WPF%20UI%20in%20upper%20case.%20Probably%20not%20the%20best%20class%20name%2C%20but%20anyway.%20To%20get%20the%20code%20and%20install%20read%20on.%0D%0A%0D%0A%0D%0A%0D%0AMake%20any%20UI%20string%20uppercase.%20Once%20you%20have%20registered%20the%20resource%20and%20created%20the%20class%20just%20use%20the%20converter%20in%20the%20eleme" rel="nofollow" class="external" title="Email this via Hotmail">Email this via Hotmail</a>
		</li>
		<li class="shr-misterwong">
			<a href="http://www.mister-wong.com/addurl/?bm_url=http://www.sytone.com/2010/08/wpf-converter-caseconverter/&amp;bm_description=WPF+Converter%3A+CaseConverter&amp;plugin=sexybookmarks" rel="nofollow" class="external" title="Add this to Mister Wong">Add this to Mister Wong</a>
		</li>
		<li class="shr-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://www.sytone.com/2010/08/wpf-converter-caseconverter/&amp;title=WPF+Converter%3A+CaseConverter" rel="nofollow" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://www.sytone.com/2010/08/wpf-converter-caseconverter/&amp;title=WPF+Converter%3A+CaseConverter" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.sytone.com/2010/08/wpf-converter-caseconverter/&amp;title=WPF+Converter%3A+CaseConverter" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://www.sytone.com/2010/08/wpf-converter-caseconverter/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.sytone.com/2010/08/wpf-converter-caseconverter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the Central Admin URL for a Farm in SharePoint</title>
		<link>http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/</link>
		<comments>http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 00:53:55 +0000</pubDate>
		<dc:creator>Sytone</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.sytone.com/?p=242</guid>
		<description><![CDATA[<p>I recently needed to get the Url of the CA for a SharePoint farm, after a bit of hunting in the API it was tracked down under the SPAdministrationWebApplication object.</p> C# SPAdministrationWebApplication caWebApp = Microsoft.SharePoint.Administration.SPAdministrationWebApplication.Local; var url = caWebApp.Sites[0].Url; PowerShell $caWebApp = [Microsoft.SharePoint.Administration.SPAdministrationWebApplication]::Local $caWebApp.Sites[0].Url Tweet This! Subscribe to the comments for this post? Share this on del.icio.us
		
		
			Digg this!
		
		
			Post this on Diigo
		
		
			Share this on Facebook
		
		
			Email this via Hotmail
		
		
			Add this to Mister Wong
		
		
			Share this on Mixx
		
		
			Share this on Reddit
		
		
			Stumble upon something good? Share it on StumbleUpon
		
		
			Share this on Technorati
		




]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" src="http://farm1.static.flickr.com/5/10700151_e80d4f8b0f_m.jpg" alt="Toy Car" width="101" height="76" />I recently needed to get the Url of the CA for a SharePoint farm, after a bit of hunting in the API it was tracked down under the SPAdministrationWebApplication object.</p>
<h3>C#</h3>
<pre class="brush:csharp">SPAdministrationWebApplication caWebApp = Microsoft.SharePoint.Administration.SPAdministrationWebApplication.Local;
var url = caWebApp.Sites[0].Url;</pre>
<h3>PowerShell</h3>
<pre>
$caWebApp = [Microsoft.SharePoint.Administration.SPAdministrationWebApplication]::Local
$caWebApp.Sites[0].Url
</pre>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint+-+http://b2l.me/apbh6n&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/&amp;title=Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/&amp;title=Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-diigo">
			<a href="http://www.diigo.com/post?url=http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/&amp;title=Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint&amp;desc=I%20recently%20needed%20to%20get%20the%20Url%20of%20the%20CA%20for%20a%20SharePoint%20farm%2C%20after%20a%20bit%20of%20hunting%20in%20the%20API%20it%20was%20tracked%20down%20under%20the%20SPAdministrationWebApplication%20object.%0D%0AC%23%0D%0ASPAdministrationWebApplication%20caWebApp%20%3D%20Microsoft.SharePoint.Administration.SPAdministrationWebApplication.Local%3B%0D%0Avar%20url%20%3D" rel="nofollow" class="external" title="Post this on Diigo">Post this on Diigo</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/&amp;t=Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-hotmail">
			<a href="http://mail.live.com/?rru=compose?subject=Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint&amp;body=Link: http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A I%20recently%20needed%20to%20get%20the%20Url%20of%20the%20CA%20for%20a%20SharePoint%20farm%2C%20after%20a%20bit%20of%20hunting%20in%20the%20API%20it%20was%20tracked%20down%20under%20the%20SPAdministrationWebApplication%20object.%0D%0AC%23%0D%0ASPAdministrationWebApplication%20caWebApp%20%3D%20Microsoft.SharePoint.Administration.SPAdministrationWebApplication.Local%3B%0D%0Avar%20url%20%3D" rel="nofollow" class="external" title="Email this via Hotmail">Email this via Hotmail</a>
		</li>
		<li class="shr-misterwong">
			<a href="http://www.mister-wong.com/addurl/?bm_url=http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/&amp;bm_description=Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint&amp;plugin=sexybookmarks" rel="nofollow" class="external" title="Add this to Mister Wong">Add this to Mister Wong</a>
		</li>
		<li class="shr-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/&amp;title=Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint" rel="nofollow" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/&amp;title=Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/&amp;title=Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When is true not true?</title>
		<link>http://www.sytone.com/2010/05/when-is-true-not-true/</link>
		<comments>http://www.sytone.com/2010/05/when-is-true-not-true/#comments</comments>
		<pubDate>Mon, 31 May 2010 10:30:17 +0000</pubDate>
		<dc:creator>Sytone</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.sytone.com/?p=208</guid>
		<description><![CDATA[<p>When you look at true stored in the .Net framework.</p> <p>While playing with Pex I found out a interesting fact that the bool is a byte in the MSIL. Which means that a bool could be euqal to anything on the byte range&#8230; Now this would require you to go out of your way [...]]]></description>
			<content:encoded><![CDATA[<p>When you look at true stored in the .Net framework.</p>
<p>While playing with Pex I found out a interesting fact that the bool is a byte in the MSIL. Which means that a bool could be euqal to anything on the byte range&#8230; Now this would require you to go out of your way and create unsafe code blocks to do this. Why you would do this&#8230; No ideas <img src='http://www.sytone.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Its marked as a no-fix which is not supprising as I would not fix it either becase as they say, if you know about this and you use it then you are on your own..</p>
<p><a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=455553&amp;wa=wsignin1.0">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=455553&amp;wa=wsignin1.0</a></p>
<p><a href="http://blog.dotnetwiki.org/2009/05/29/TamingThePexBeastWellbehavedEnumsMultidimensionalArraysAndBooleans.aspx">http://blog.dotnetwiki.org/2009/05/29/TamingThePexBeastWellbehavedEnumsMultidimensionalArraysAndBooleans.aspx</a></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=When+is+true+not+true%3F++-+http://b2l.me/apbenf&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://www.sytone.com/2010/05/when-is-true-not-true/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.sytone.com/2010/05/when-is-true-not-true/&amp;title=When+is+true+not+true%3F+" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.sytone.com/2010/05/when-is-true-not-true/&amp;title=When+is+true+not+true%3F+" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-diigo">
			<a href="http://www.diigo.com/post?url=http://www.sytone.com/2010/05/when-is-true-not-true/&amp;title=When+is+true+not+true%3F+&amp;desc=When%20you%20look%20at%20true%20stored%20in%20the%20.Net%20framework.%0D%0A%0D%0AWhile%20playing%20with%20Pex%20I%20found%20out%20a%20interesting%20fact%20that%20the%20bool%20is%20a%20byte%20in%20the%20MSIL.%20Which%20means%20that%20a%20bool%20could%20be%20euqal%20to%20anything%20on%20the%20byte%20range...%20Now%20this%20would%20require%20you%20to%20go%20out%20of%20your%20way%20and%20create%20unsafe%20code%20blocks%20to%20" rel="nofollow" class="external" title="Post this on Diigo">Post this on Diigo</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.sytone.com/2010/05/when-is-true-not-true/&amp;t=When+is+true+not+true%3F+" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-hotmail">
			<a href="http://mail.live.com/?rru=compose?subject=When+is+true+not+true%3F+&amp;body=Link: http://www.sytone.com/2010/05/when-is-true-not-true/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A When%20you%20look%20at%20true%20stored%20in%20the%20.Net%20framework.%0D%0A%0D%0AWhile%20playing%20with%20Pex%20I%20found%20out%20a%20interesting%20fact%20that%20the%20bool%20is%20a%20byte%20in%20the%20MSIL.%20Which%20means%20that%20a%20bool%20could%20be%20euqal%20to%20anything%20on%20the%20byte%20range...%20Now%20this%20would%20require%20you%20to%20go%20out%20of%20your%20way%20and%20create%20unsafe%20code%20blocks%20to%20" rel="nofollow" class="external" title="Email this via Hotmail">Email this via Hotmail</a>
		</li>
		<li class="shr-misterwong">
			<a href="http://www.mister-wong.com/addurl/?bm_url=http://www.sytone.com/2010/05/when-is-true-not-true/&amp;bm_description=When+is+true+not+true%3F+&amp;plugin=sexybookmarks" rel="nofollow" class="external" title="Add this to Mister Wong">Add this to Mister Wong</a>
		</li>
		<li class="shr-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://www.sytone.com/2010/05/when-is-true-not-true/&amp;title=When+is+true+not+true%3F+" rel="nofollow" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://www.sytone.com/2010/05/when-is-true-not-true/&amp;title=When+is+true+not+true%3F+" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.sytone.com/2010/05/when-is-true-not-true/&amp;title=When+is+true+not+true%3F+" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://www.sytone.com/2010/05/when-is-true-not-true/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.sytone.com/2010/05/when-is-true-not-true/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting a Outlook MailItem from a Ribbon Event</title>
		<link>http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/</link>
		<comments>http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 10:01:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[outlook]]></category>

		<guid isPermaLink="false">http://www.sytone.com/?p=167</guid>
		<description><![CDATA[<p>You may find this code block handy:</p> /// /// Gets the mail item selected in the explorer view if one is selected or instance if that is the view active. /// /// The instance containing the event data. /// A Outlook.MailItem for the mail being viewed. private Outlook.MailItem GetMailItem(RibbonControlEventArgs e) { // Check to see [...]]]></description>
			<content:encoded><![CDATA[<p>You may find this code block handy:</p>
<pre class="brush:csharp">        ///
        /// Gets the mail item selected in the explorer view if one is selected or instance if that is the view active.
        ///
        ///
The  instance containing the event data.
        /// A Outlook.MailItem for the mail being viewed.
        private Outlook.MailItem GetMailItem(RibbonControlEventArgs e)
        {
            // Check to see if a item is select in explorer or we are in inspector.
            if (e.Control.Context is Outlook.Inspector)
            {
                Outlook.Inspector inspector = (Outlook.Inspector)e.Control.Context;

                if (inspector.CurrentItem is Outlook.MailItem)
                {
                    return inspector.CurrentItem as Outlook.MailItem;
                }
            }

            if (e.Control.Context is Outlook.Explorer)
            {
                Outlook.Explorer explorer = (Outlook.Explorer)e.Control.Context;

                Outlook.Selection selectedItems = explorer.Selection;
                if (selectedItems.Count != 1)
                {
                    return null;
                }

                if (selectedItems[1] is Outlook.MailItem)
                {
                    return selectedItems[1] as Outlook.MailItem;
                }
            }

            return null;
        }</pre>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Getting+a+Outlook+MailItem+from+a+Ribbon+Event+-+http://b2l.me/aph8g8&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/&amp;title=Getting+a+Outlook+MailItem+from+a+Ribbon+Event" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/&amp;title=Getting+a+Outlook+MailItem+from+a+Ribbon+Event" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-diigo">
			<a href="http://www.diigo.com/post?url=http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/&amp;title=Getting+a+Outlook+MailItem+from+a+Ribbon+Event&amp;desc=You%20may%20find%20this%20code%20block%C2%A0handy%3A%0D%0A%20%20%20%20%20%20%20%20%2F%2F%2F%0D%0A%20%20%20%20%20%20%20%20%2F%2F%2F%20Gets%20the%20mail%20item%20selected%20in%20the%20explorer%20view%20if%20one%20is%20selected%20or%20instance%20if%20that%20is%20the%20view%20active.%0D%0A%20%20%20%20%20%20%20%20%2F%2F%2F%0D%0A%20%20%20%20%20%20%20%20%2F%2F%2F%0D%0AThe%20%20instance%20containing%20the%20event%20data.%0D%0A%20%20%20%20%20%20%20%20%2F%2F%2F%20A%20Outlook.MailItem%20for%20the%20mail%20being%20viewed.%0D%0A%20" rel="nofollow" class="external" title="Post this on Diigo">Post this on Diigo</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/&amp;t=Getting+a+Outlook+MailItem+from+a+Ribbon+Event" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-hotmail">
			<a href="http://mail.live.com/?rru=compose?subject=Getting+a+Outlook+MailItem+from+a+Ribbon+Event&amp;body=Link: http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A You%20may%20find%20this%20code%20block%C2%A0handy%3A%0D%0A%20%20%20%20%20%20%20%20%2F%2F%2F%0D%0A%20%20%20%20%20%20%20%20%2F%2F%2F%20Gets%20the%20mail%20item%20selected%20in%20the%20explorer%20view%20if%20one%20is%20selected%20or%20instance%20if%20that%20is%20the%20view%20active.%0D%0A%20%20%20%20%20%20%20%20%2F%2F%2F%0D%0A%20%20%20%20%20%20%20%20%2F%2F%2F%0D%0AThe%20%20instance%20containing%20the%20event%20data.%0D%0A%20%20%20%20%20%20%20%20%2F%2F%2F%20A%20Outlook.MailItem%20for%20the%20mail%20being%20viewed.%0D%0A%20" rel="nofollow" class="external" title="Email this via Hotmail">Email this via Hotmail</a>
		</li>
		<li class="shr-misterwong">
			<a href="http://www.mister-wong.com/addurl/?bm_url=http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/&amp;bm_description=Getting+a+Outlook+MailItem+from+a+Ribbon+Event&amp;plugin=sexybookmarks" rel="nofollow" class="external" title="Add this to Mister Wong">Add this to Mister Wong</a>
		</li>
		<li class="shr-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/&amp;title=Getting+a+Outlook+MailItem+from+a+Ribbon+Event" rel="nofollow" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/&amp;title=Getting+a+Outlook+MailItem+from+a+Ribbon+Event" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/&amp;title=Getting+a+Outlook+MailItem+from+a+Ribbon+Event" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: www.sytone.com @ 2010-09-09 14:34:21 by W3 Total Cache -->