<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Ryan's Developer Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/rgregg/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/rgregg/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 05:25:26 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>App Folders and the new JavaScript picker</title>
      <link>https://docs.microsoft.com/archive/blogs/rgregg/app-folders-and-the-new-javascript-picker</link>
      <pubDate>Wed, 01 Apr 2015 14:43:57 GMT</pubDate>
      <dc:creator><![CDATA[rgregg@outlook.com]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rgregg/2015/04/01/app-folders-and-the-new-javascript-picker/</guid>
      <description><![CDATA[We&rsquo;ve had a busy month of March working on improving the OneDrive API. Today we launched two...]]></description>
      <content:encoded><![CDATA[<p class="p1"><span class="s1">We&rsquo;ve had a busy month of March working on improving the OneDrive API. Today we launched two new platform features to make using OneDrive in your apps easier:</span></p>
<ul class="ul1">
<li class="li1"><span class="s2"><a href="http://onedrive.github.io/misc/appfolder.htm"><span class="s3">App Folders</span></a></span><span class="s1">&nbsp;&ndash; Request access only to a special folder for your application in OneDrive. Store files in OneDrive without requesting permission to access an entire drive.</span></li>
<li class="li1"><span class="s2"><a href="http://onedrive.github.io/sdk/javascript-picker-saver.htm"><span class="s3">JavaScript picker &amp; saver SDK</span></a></span><span class="s1">&nbsp;&ndash; Easily open and save files to OneDrive from your web app without asking for ongoing permissions to OneDrive.</span></li>
</ul>
<p class="p1">We also refreshed our dev center website with a new table of contents for the API documentation to make it easier to navigate and find what you&rsquo;re looking for. For the super nerds, you can even check out the latest documentation <a href="https://ci.appveyor.com/project/OneDrive/onedrive-api-docs"><span class="s4">continuous integration status</span></a>&nbsp;that ensures our documentation is always accurate!</p>
<p class="p1">Don't miss us at the //Build and Ignite conferences coming up at the end of April. I&rsquo;ll be there speaking about how to quickly integrate OneDrive into your apps and have some exciting news to share! Hope to see you there.</p>]]></content:encoded>
    </item>
    <item>
      <title>Using onedrive-explorer-win sample SDK with store apps</title>
      <link>https://docs.microsoft.com/archive/blogs/rgregg/using-onedrive-explorer-win-sample-sdk-with-store-apps</link>
      <pubDate>Wed, 18 Mar 2015 13:44:00 GMT</pubDate>
      <dc:creator><![CDATA[rgregg@outlook.com]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rgregg/2015/03/18/using-onedrive-explorer-win-sample-sdk-with-store-apps/</guid>
      <description><![CDATA[A couple of folks have asked me recently how they can use the sample SDK in the...]]></description>
      <content:encoded><![CDATA[<p>A couple of folks have asked me recently how they can use the sample SDK in the <a href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/github.com/onedrive/onedrive-explorer-win">onedrive-explorer-win</a> project inside a Windows Store app. Since Store apps handle authentication differently and don't depend on OAuth. I've created a gist to show how you can <a href="https://gist.github.com/rgregg/0f45cebbfbde4b7e4157">use the Windows Store APIs to get an access token and provide that token to the ODConnection class</a> in the sample SDK.</p>
<p>&nbsp;</p>
<p>Fortunately, it's pretty straight forward. The sample SDK is looking for authentication to come in the form of an object that implements the IAuthenticationInfo interface defined in the sample SDK. The interface is pretty straightforward, and has properties such as AccessToken, RefreshToken, TokenType, and a few others. Implementing this is pretty easy.</p>
<pre class="scroll"><code class="csharp">public class AuthToken : OneDrive.IAuthenticationInfo<br />{<br /> public string AccessToken { get; private set; }<br /> <br /> public string RefreshToken { get; private set; }<br /> <br /> public string TokenType { get { return "Bearer"; } }<br /> <br /> public DateTimeOffset TokenExpiration { get; private set; }<br /> <br /> public Task&lt;bool&gt; RefreshAccessTokenAsync()<br /> {<br /> throw new NotImplementedException();<br /> }<br /> <br /> public string AuthorizationHeaderValue { get { return "Bearer " + AccessToken; } }<br /> }</code></pre>
<p>The slightly harder part is getting the access token and other details from the Windows API. However, after reading up on the subject on MSDN, I got it working. You need to become familiar with the Windows.Security.Authentication.OnlineId namespace and classes, which is where the magic happens.</p>
<p>To request a token from the Windows APIs, you need to create a new instance of the OnlineIdAuthenticator class:</p>
<pre class="scroll"><code class="csharp">Authenticator = new OnlineIdAuthenticator();</code></pre>
<p>Once you have that created, you can ask for an access token that contains a set of scopes and conditionally prompts the user or not:</p>
<pre class="scroll"><code class="csharp">string accessToken = null;<br />string scopes = "onedrive.readwrite";<br /> <br />CredentialPromptType promptType = silent ? CredentialPromptType.DoNotPrompt : CredentialPromptType.PromptIfNeeded;<br />var ticketRequests = new List&lt;OnlineIdServiceTicketRequest&gt;();<br />ticketRequests.Add(new OnlineIdServiceTicketRequest(scopes, OnlineIdTicketPolicyForLiveServices));<br /> <br />UserIdentity identity = await Authenticator.AuthenticateUserAsync(ticketRequests, promptType);<br />if (identity.Tickets != null &amp;&amp; identity.Tickets.Count &gt; 0)<br />{<br /> accessToken = identity.Tickets[0].Value;<br />}<br /></code></pre>
<p>The <strong>OnlineIdTicketPolicyForLiveServices</strong> constant is set to "DELEGATION" which is required for using Microsoft Account credentials.</p>
<p>Once you have the accessToken value back, you can store that value into your implementation of IAuthenticationInfo and pass that to the ODConnection object and everything should work.</p>
<p>For the complete code sample for how to implement this, see my <a href="https://gist.github.com/rgregg/0f45cebbfbde4b7e4157">Windows Store App Sign-in for OneDrive SDK gist</a> on GitHub.</p>]]></content:encoded>
    </item>
    <item>
      <title>New OneDrive API</title>
      <link>https://docs.microsoft.com/archive/blogs/rgregg/new-onedrive-api</link>
      <pubDate>Mon, 23 Feb 2015 23:19:00 GMT</pubDate>
      <dc:creator><![CDATA[rgregg@outlook.com]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rgregg/2015/02/23/new-onedrive-api/</guid>
      <description><![CDATA[For the last several months I've been working closely with a number of engineers to build a new...]]></description>
      <content:encoded><![CDATA[<p>For the last several months I've been working closely with a number of engineers to build a <a href="https://aka.ms/onedriveapi">new OneDrive API</a>. For those of you who have built apps with OneDrive in the past, you know that Live SDK provided basic access to OneDrive but was often lacking if you wanted to accomplish more advanced scenarios with OneDrive. We listened to feedback developers posted on our <a href="http://onedrive.uservoice.com">User Voice</a> and <a href="http://stackoverflow.com/questions/tagged/onedrive">Stack Overflow</a> pages and went to work to make it easier to integrate with OneDrive than any other cloud storage system. The result of this effort is the new OneDrive API I'm proud to be <a href="https://blog.onedrive.com/the-new-onedrive-api/">announcing today</a>!</p>
<p>For our release today, we're also shipping sample code for C# and JavaScript. With our focus on cross-platform development though, we'll be delivering samples for Android and iOS over the coming weeks. We'll be releasing a full blown SDK for OneDrive integration over the next few months to make it even easier to integrate OneDrive into your app. We know having high quality sample code and code libraries that provide most of the connectivity between your app and the service is important, and we're working to quickly deliver additional code samples. However, we've focused on building a great, easy to use API and writing the best documentation we can to describe the API to help you get started in the mean time. I think we've really delivered both a great API and great documentation to go along with it. I'm interested in your feedback about the quality of our API and the docs that go along with it.</p>
<p>Over the next year we'll continue to deliver more developer platform features for OneDrive. I'll be at the <a href="http://www.buildwindows.com/">Build</a> and <a href="http://ignite.microsoft.com/">Ignite</a> conferences this Spring to talk about the OneDrive platform and announce the next great set of features for OneDrive developers. Hope to see you there!</p>]]></content:encoded>
    </item>
    <item>
      <title>Easy MSA OAuth in Windows Forms</title>
      <link>https://docs.microsoft.com/archive/blogs/rgregg/easy-msa-oauth-in-windows-forms</link>
      <pubDate>Thu, 02 Oct 2014 15:20:36 GMT</pubDate>
      <dc:creator><![CDATA[rgregg@outlook.com]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rgregg/2014/10/02/easy-msa-oauth-in-windows-forms/</guid>
      <description><![CDATA[Sometimes when you want to quickly demo something, writing a quick Windows Form app is the easiest...]]></description>
      <content:encoded><![CDATA[<p>Sometimes when you want to quickly demo something, writing a quick Windows Form app is the easiest thing to do. It's not the "modern" way to write software, but if you're just trying something out it's easier to get bits running.</p>
<p>To that end, I've been writing a number of little apps to test various OneDrive integration pieces lately. I found I often needed a quick and easy way to do OAuth 2.0 flows using Microsoft Accounts. I borrowed some code and whipped up an easy-to-use Windows Form class that easily gets back either an access token (implicit grant flow) or authorization code (authorization code grant flow) that I'm now using in all of these projects. If it's useful for me, I figure it may be useful for someone else, so I've posted it as a Gist over on GitHub.</p>
<p><a href="https://gist.github.com/rgregg/6f7332e998e76a16bbac" target="_blank">https://gist.github.com/rgregg/6f7332e998e76a16bbac</a></p>
<p>Feel free to fork, comment, or submit pull requests for improvements!</p>
<p>&nbsp;</p>
<p>Update: I've posted the latest version of this code as a NuGet package that makes it easy for anyone to consume it. Check out the <a href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/OAuth Library for Microsoft Accounthttps:/www.nuget.org/packages/MicrosoftAccount.WindowsForms/">OAuth Library for Microsoft Account</a>.</p>]]></content:encoded>
    </item>
    <item>
      <title>I'm back</title>
      <link>https://docs.microsoft.com/archive/blogs/rgregg/im-back</link>
      <pubDate>Sat, 16 Aug 2014 14:57:36 GMT</pubDate>
      <dc:creator><![CDATA[rgregg@outlook.com]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rgregg/2014/08/16/im-back/</guid>
      <description><![CDATA[After a four year break, I'm back in the developer space. However, instead of Outlook I've moved to...]]></description>
      <content:encoded><![CDATA[<p>After a four year break, I'm back in the developer space. However, instead of Outlook I've moved to the OneDrive team. Over time I'll be blogging about developing using Live Connect, Live SDK, and the various other OneDrive APIs available. Look for more details in upcoming posts!</p>]]></content:encoded>
    </item>
    <item>
      <title>Office 2010 Released to Manufacturing!</title>
      <link>https://docs.microsoft.com/archive/blogs/rgregg/office-2010-released-to-manufacturing</link>
      <pubDate>Mon, 19 Apr 2010 12:31:48 GMT</pubDate>
      <dc:creator><![CDATA[rgregg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rgregg/2010/04/19/office-2010-released-to-manufacturing/</guid>
      <description><![CDATA[On Friday we signed off on all of the Office 2010 products, including Outlook 2010 and have released...]]></description>
      <content:encoded><![CDATA[<p>On Friday we signed off on all of the Office 2010 products, including Outlook 2010 and have released them to manufacturing! A journey we started 3.5 years ago is complete! Outlook 2010 is the best version of Outlook ever, including a number of great new features and some exciting platform changes as well.</p>  <p>Stop by the <a href="http://msdn.microsoft.com/en-us/office/aa905455.aspx">Outlook Developer Center</a> for access to a number of different Outlook development resources (soon to be updated to include Outlook 2010 resources, stay tuned!).</p>  <p>Another good stop for the Outlook developer is to check out the Office Client Developer blog, including a new post from Angela with <a href="http://blogs.msdn.com/officedevdocs/archive/2010/04/16/new-managed-code-examples-for-outlook-2010.aspx">managed code samples for Outlook 2010</a>.</p>  <p>If you’re interested in <a href="http://msdn.microsoft.com/en-us/library/ee829696(office.14).aspx">developing a provider for the Outlook Social Connector</a>, don’t miss the content all about how to do that.</p>]]></content:encoded>
    </item>
    <item>
      <title>Outlook Social Connector and Developers</title>
      <link>https://docs.microsoft.com/archive/blogs/rgregg/outlook-social-connector-and-developers</link>
      <pubDate>Thu, 19 Nov 2009 17:04:51 GMT</pubDate>
      <dc:creator><![CDATA[rgregg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rgregg/2009/11/19/outlook-social-connector-and-developers/</guid>
      <description><![CDATA[Hopefully you caught the news yesterday at PDC09 that Microsoft Office 2010 beta is now available...]]></description>
      <content:encoded><![CDATA[<p>Hopefully you caught the news yesterday at PDC09 that <a href="http://www.microsoft.com/2010">Microsoft Office 2010 beta</a> is now available for download! One of the cool new features added in the beta for Outlook 2010 is the <a href="http://blogs.msdn.com/outlook/archive/2009/11/18/announcing-the-outlook-social-connector.aspx">Outlook Social Connector</a>, which connects social network data into Outlook and displays relevant information to you based on the current context.</p>  <p>This is a great feature, and will enable all sorts of great scenarios. Even cooler, it’s a new platform that can be leveraged by developers looking to integrate with Outlook. Today Randy Byrne posted details over on the Outlook blog about <a href="http://blogs.msdn.com/outlook/archive/2009/11/19/developing-a-provider-for-the-outlook-social-connector.aspx">how to integrate with the OSC</a>.</p>  <p>Out of the box, Outlook will connect to SharePoint 2010, and we’ve announced a partnership with LinkedIn to connect with as well. However, anyone can build a provider to plug into the OSC and provide data from any data source. Some examples we’ve been thinking of include connecting to an internal CRM system, to show the latest updates about a customer when you receive an e-mail.</p>  <p>If you’re interested, make sure you download the beta and try building an OSC Provider. Click through to Randy’s post for more information.</p>]]></content:encoded>
    </item>
    <item>
      <title>Additional Shutdown Changes for Outlook 2010 Beta</title>
      <link>https://docs.microsoft.com/archive/blogs/rgregg/additional-shutdown-changes-for-outlook-2010-beta</link>
      <pubDate>Fri, 02 Oct 2009 17:46:00 GMT</pubDate>
      <dc:creator><![CDATA[rgregg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rgregg/2009/10/02/additional-shutdown-changes-for-outlook-2010-beta/</guid>
      <description><![CDATA[As part of Outlook 2010 and Outlook 2007 SP2, the Outlook team has taken a new and harder stance on...]]></description>
      <content:encoded><![CDATA[<P>As part of Outlook 2010 and Outlook 2007 SP2, the Outlook team has taken a new and harder stance on performance. We strived to make these versions of Outlook the fastest, most performant versions released. To accomplish this, we’ve been making some significant changes to the way Outlook works across the board and in shutdown specifically. Over the course of the last year, we’ve focused on ensuring Outlook shuts down properly when the user closes the application.</P>
<H4>Background</H4>
<P>Outlook often has issues shutting down on command. Even when it did shutdown, it often took much longer than expected. Our goal for this release is to ensure Outlook <B>always</B> shuts down and put this issue to rest. With this release we want to put this issue to rest. To facilitate that, we started making a series of changes that ensure Outlook shuts down quickly and consistently. </P>
<P>In Outlook 2007 SP2, we <A href="http://blogs.msdn.com/rgregg/archive/2008/10/27/application-shutdown-changes-in-outlook-2007-service-pack-2-beta.aspx" mce_href="http://blogs.msdn.com/rgregg/archive/2008/10/27/application-shutdown-changes-in-outlook-2007-service-pack-2-beta.aspx">added a new design to MAPI providers</A> where we only do the minimal work necessary to prevent data loss before Outlook exits and will sidestep some of the normal shutdown logic. Outlook SP2 also prevents external COM add-ins from keeping Outlook running after the user closed Outlook. The big pain point was that all MAPI Providers had to opt-in to the design and support the new behavior because of compatibility concerns of this change in a service pack.</P>
<P>In Outlook 2010 Technical Preview, the design was modified so that a MAPI provider needed to opt-out of the new shutdown method. If a MAPI provider does not implement the fast shutdown API, Outlook 2010 will still shut down using the fast method. </P>
<P>These changes have done a lot to ensure that Outlook always shuts down and is able to shut down quickly, as the user intended. Since the technical preview release, we continued to monitor the feedback from beta testers and users to determine how effective these changes have been. Looking through the data we’ve collected, it’s become clear that there is another significant source of shutdown pain: Outlook add-ins. We found that add-ins would perform expensive operations and network I/O during shut down events. Because of that impact, we expanded our investment in improving Outlook’s shutdown behavior by creating a fast shutdown model for add-ins as well.</P>
<H4>Add-in Shutdown Changes in Outlook 2010 Beta</H4>
<P>Starting with the Outlook 2010 Beta, Outlook, by default, will not signal add-ins that it is shutting down. Specifically, the beta version will no longer call <B>OnBeginShutdown</B> and <B>OnDisconnection</B> methods of the IDTExtensibility2 interface when Outlook is shutting down with fast shutdown. If you have a Visual Studio Tools for Office (VSTO) add-in, you will not see the <B>ThisAddin_Shutdown</B> method called.</P>
<P>The impact to an add-in from this change depends on what the add-in was doing during these events. In most add-ins, these events are used to release references to Outlook COM objects and clean memory that was allocated during the session. In these cases, the impact to the add-in will be minimal. Outlook will release the remaining COM object references and shutdown, and Windows will reclaim the allocated memory when the process exits.</P>
<P>For some add-ins, the change is more impactful. If an add-in uses these events to commit data (for example, storing user settings or reporting usage to a web server) this will no longer occur. Depending on the scenario, this may or may not have a user visible impact. Add-ins will either need to be modified to be compatible with this new behavior, or an IT administrator will need to use group policy to restore the original behavior for the specific add-in. </P>
<P>These methods can and will be called in other scenarios, such as if the add-in is manually disconnected or if slow shutdown is enabled through group policy, so it is important that developers continue to code as though these methods would be called. More information about best practices is listed below.</P>
<H4>Reasons for this Change</H4>
<P>This change has a pretty significant impact and is not a change we made lightly. Looking over the data we’ve collected in the last year, it became clear we needed to do more to help shutdown faster. The data from Outlook 2007 SP2 indicated that if the user had “misbehaving” add-ins installed, the average delay to shutdown was 13 seconds. For Outlook 2010 technical preview, the data shows an average delay of 15-20 seconds.</P>
<P>As part of our add-in compatibility testing, we’ve examined what add-ins are doing in their shutdown/disconnect events. While a majority of add-ins are performing simple tasks like releasing references, several add-ins we’ve identified are making web service calls or other “long running” operations synchronously during these events. </P>
<P>The benefit of making this change is that for the majority of add-ins and customers, Outlook will work significantly better than it has in the past when shutting down. This change improves our ability to respond to the user’s intent and exit quickly, letting the user move on to the next task or shutdown their computer. </P>
<H4>For Developers: Best Practices for Add-in Shutdown</H4>
<P>For add-in developers, the new world of Outlook shutdown can seem a little tricky to operate in. It is important that developers follow the best practices for add-in shutdown to ensure that our shared users continue to benefit from a fast and responsible Outlook shutdown experience.</P>
<H5>Practice #1: Continue to Release References in OnDisconnection</H5>
<P>It is important that you continue to write code in <B>OnDisconnection</B> or <B>ThisAddin_Shutdown</B> to release any remaining COM references to Outlook objects. In Outlook 2003 and Outlook 2007 pre-SP2, these references can prevent Outlook from shutting down. Even in Outlook 2010 you should continue to release references and allocated memory in these events because there are scenarios where slow shutdown will be used or the user could manually disconnect your add-in through the COM Add-ins dialog.</P>
<H5>Practice #2: Detecting when Outlook is shutting down</H5>
<P>If you need to detect that Outlook is shutting down, you can use the <B>Application.Quit</B> event in the Outlook object model to receive a notification that the process is shutting down. You should respond quickly to this event and return control back to Outlook as quickly as possible. Add-ins should focus on not having a perceivable impact on Outlook shutdown when compared with shutdown when the add-in is not running.</P>
<P>If you have long running or indeterminate length running operations to perform at shutdown, consider the following questions:</P>
<UL>
<LI>Does this need to happen when Outlook shuts down? What happens if Outlook crashes and this code doesn’t run?</LI>
<LI>Can the operation be made to be “pay for play” where changes are committed when the user makes the change instead of being saved for later?</LI>
<LI>Can the work be done on a background thread instead of synchronously during a quit event? (Note: you cannot make OM calls from a background thread, but can use MAPI directly if properly initialized)</LI></UL>
<P>Explicitly, you should not do network I/O during any quit event. This includes saving data to a network share, writing data to an Outlook online-mode store, or calling web services during Application.Quit, OnBeginShutdown or OnDisconnection.</P>
<P>In using the Application.Quit event, you should not perform any release of Outlook COM objects or allocated memory in the Outlook process space. This will be done for you by Outlook and Windows when the process exits.</P>
<P>One case we’ve seen internally as we started looking at what add-ins were doing during shutdown was where an add-in was reporting usage information back to a web service in the shutdown events. Instead of recording this data directly to the web service during shutdown, we altered the code to instead report the previous session usage information on a background thread sometime during the next Outlook boot. This way the data can still be uploaded, but Outlook is never blocked by the work.</P>
<P>Another alternative, if you have another executable that is already part of your solution, is to move work out of the add-in and into your executable. This way the work can be done regardless of if Outlook is running, and without blocking Outlook’s ability to start up or shut down quickly.</P>
<H5>Practice #3: Test shutdown using both the fast and old methods</H5>
<P>As a developer, you should ensure that your add-in has a negligible impact on Outlook’s user experience. This includes testing the impact your add-in makes to Outlook’s boot time, the general user experience while using Outlook, common scenarios (like composing a new message, replying to a message, folder switch, sending mail, etc) and shut down. Specifically, developers should test the difference between the shutdown times of outlook when changing the registry settings for the add-in that control how Outlook shuts down.</P>
<H4>For IT Administrators</H4>
<P>If you have internal add-ins or solutions that cannot be updated to support the new design, you can deploy group policy to your users to revert the behavior. There are two methods for enabling shutdown notifications to Outlook add-ins in Outlook 2010 Beta:</P>
<UL>
<LI><B>Selectively for individual add-ins (the preferred approach):</B> While this cannot be deployed through group policy, it can be enabled as part of add-in deployments and is useful if backwards compatibility is required for specific add-ins.</LI>
<LI><B>Globally for all add-ins</B>: this is recommended for organizations with a large number of internal solutions or desktops that need to deploy this setting to ensure compatibility during a rollout of Outlook 2010.</LI></UL>
<H5>Individual Add-in Setting</H5>
<P>By using this setting Outlook will selectively provide shutdown notifications to the specified add-in without notifying all add-ins. This setting is configured per add-in through the add-in registration in either HKCU or HKLM registry hives, by adding an additional value to the add-in registration:</P>
<P><FONT face="Courier New">HKCU\Software\Microsoft\Office\Outlook\Add-ins\&lt;ProgID&gt; <BR>[RequireShutdownNotification]=dword:0x1</FONT></P>
<P>Setting this value to 0x1 will enable the add-in to receive the blocked callbacks during Outlook shutdown. This will have an impact to the performance of Outlook shutdown that should be evaluated as part of a deployment. This setting should only be used if an add-in has significant compatibility issues with Outlook 2010’s new shutdown design.</P>
<H5>Global Setting</H5>
<P>This setting can be used to change the new shutdown design to match the design used by Outlook 2007. This setting can be deployed through group policy either per user or per machine.</P>
<P><FONT face="Courier New">HKCU\Policies\Microsoft\Office\Outlook\14.0\Options\Shutdown <BR>[AddinFastShutdownBehavior]=dword:0x1</FONT></P>
<P>Setting AddinFastShutdownBehavior to 1 will enable shutdown notifications for all add-ins. Setting the value to 0 will use the default behavior.</P>
<P>These two settings provide administrators complete control over the effect this new behavior has on custom solutions and add-ins used in the enterprise. During evaluation of Outlook 2010 beta, it is important that organizations test any custom solutions using Outlook add-ins to ensure compatibility with this change.</P>]]></content:encoded>
    </item>
    <item>
      <title>Application Shutdown Changes in Outlook 2007 Service Pack 2 Beta</title>
      <link>https://docs.microsoft.com/archive/blogs/rgregg/application-shutdown-changes-in-outlook-2007-service-pack-2-beta</link>
      <pubDate>Mon, 27 Oct 2008 15:17:36 GMT</pubDate>
      <dc:creator><![CDATA[rgregg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rgregg/2008/10/27/application-shutdown-changes-in-outlook-2007-service-pack-2-beta/</guid>
      <description><![CDATA[As part of the performance improvements we’ve made for Outlook 2007 SP2 beta, we’ve changed the way...]]></description>
      <content:encoded><![CDATA[<p>As part of the performance improvements we’ve made for Outlook 2007 SP2 beta, we’ve changed the way Outlook manages the lifecycle of the application. In the past, Outlook followed the best practices for Component Object Model (COM) servers and allowed clients of the Outlook server to control the lifecycle of Outlook. This caused a significant end-user side effect: often the user could not close Outlook because of lingering external references. This is confusing and frustrating for our users, and many users would often use Task Manager to terminate the Outlook process.</p>  <p>As a result of strong and long-standing customer feedback about the need to close Outlook and have Outlook stop running, Service Pack 2 changes the way Outlook closes, ensuring that the user’s intent to close Outlook is respected. These changes mean the way the Outlook COM server shuts down has changed significantly, which may impact solutions using the Outlook object model outside of the Outlook process.</p>  <h4>Impact for Add-ins: None</h4>  <p><b>If you’ve written an in-process add-in for Outlook this change does not affect you.</b> The lifecycle of in-process add-ins and in-process COM references in Outlook 2007 has always been the same as the lifecycle of the application. When the user closes the last Outlook window and Outlook starts to shut down, add-ins are disconnected and references are released.</p>  <p>Add-ins can use the Quit event on the Application object to determine when Outlook will be closing down. After the Quit event is raised, add-ins will have their OnDisconnection method called, and then the add-in and Outlook will close.</p>  <h4>Impact for Cross Process Solutions</h4>  <p>Before Outlook 2007 SP2, Outlook would check for external (out of process) references on the COM Server objects and wait for those references to be released before Outlook would close. This would enable solutions that were depending on Outlook data to keep Outlook running until the references were released. This is common behavior for COM servers, but is unexpected behavior for end users, who expect that an application will close when they close the last window of the application (or at least reasonably soon after they close the last window).</p>  <p>Starting with Outlook 2007 Service Pack 2, Outlook will ignore external COM references when determining if Outlook should exit. When a user closes the last Outlook window, Outlook will start exiting the process: this involves raising the Quit event on the Application object, disconnect all add-ins, disconnecting external references, persisting in-memory changes to the disk, and then exiting. All external COM references will be disconnected immediately after the Quit event is raised on the Application object.</p>  <p>Because of the way COM works, when Outlook releases the external references, those objects become disconnected objects in cross process solutions. When a solution attempts to use the disconnected reference, an error will result from any call to the object (RPC_E_DISCONNECTED). Solutions that are not designed to handle this error may crash or otherwise misbehave. This will occur any time a solution attempts to use an object reference after Outlook has closed.</p>  <p>To work correctly with the new behavior in Outlook, your solution should listen for the Quit event on the Application object. When that event is raised, stop any work in progress using Outlook data, and release all Outlook references. Any remaining references after the solution returns from the Quit event will be disconnected. </p>  <p>While handling the Quit event, a solution should return from the event as quickly as possible. While a solution is working in the Quit event, Outlook may appear hung to the user and the operating system and the user may forcibly terminate Outlook instead of waiting for it to finish closing. </p>  <p>If your solution needs to access data from Outlook after the process has shutdown, it can do so by starting the process up again in UI-less mode by calling CoCreateInstance(). However, you should attempt to design your solution such that data from Outlook is only collected while Outlook is running. I’ll be blogging about an example of how to design a solution that works this way in an upcoming blog post.</p>  <h4>Special Cases</h4>  <p>While the text above describes the default, we realize that there are customers and solutions which will be negatively impacted by this change until the solution can be updated. To restore the old behavior, administrators can set a registry key to force Outlook to wait for all external references to be released before closing.</p>  <p><b><i>This registry key applies to Outlook 2007 SP2 beta, the registry key may change for the final release of SP2.</i></b></p>  <p>[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Shutdown]    <br />“AllowShutdownWithExternalReferences”=dword:00000000</p>  <p>We’ve also done work to ensure that when a solution uses CoCreateInstance and Outlook isn’t running, the right things happen. In those cases, Outlook will remain running in “headless mode” without any visible user interface. If the user launches Outlook, a new Outlook window will appear in the same session Outlook was already using. If the user closes that window, even though the process was started by a solution, Outlook will exit in the same manner as it would if the application was started by the user.</p>  <h4>Summary</h4>  <p>As part of a larger overall performance improvement effort in Outlook 2007 Service Pack 2, the team has invested a significant amount of time to improve the experience around closing Outlook. We’ve also made changes to ensure that Outlook boots faster and is more responsive all around. </p>  <p>I’m interested in your feedback on this new shutdown logic, and any thoughts or questions about how we can continue to improve this experience in the next Outlook release. Please leave a comment on this post and let me know what you have to say.</p>]]></content:encoded>
    </item>
    <item>
      <title>Use the Right Events for the Right Cases</title>
      <link>https://docs.microsoft.com/archive/blogs/rgregg/use-the-right-events-for-the-right-cases</link>
      <pubDate>Wed, 27 Aug 2008 14:25:00 GMT</pubDate>
      <dc:creator><![CDATA[rgregg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rgregg/2008/08/27/use-the-right-events-for-the-right-cases/</guid>
      <description><![CDATA[One of the problems I often hear about from Outlook developers is that the sequencing of a...]]></description>
      <content:encoded><![CDATA[<P>One of the problems I often hear about from Outlook developers is that the sequencing of a particular event isn’t ideal for what they are trying to do. While sometimes this can be a hole in the Outlook platform, more often than not it’s because the developer isn’t using the best event for the scenario they are trying to build. Outlook often has multiple events that fire related to particular actions in the UI, and choosing the right event is important to ensure data consistency.</P>
<P>For example, recently I was helping a partner team who wanted to examine the contents of a meeting request when the user has actually sent the request. During this event, they would compare the state of the meeting in their system against the meeting that the user was sending, and fix up any inconsistencies in their database. The developer had found the <I style="mso-bidi-font-style: normal">AppointmentItem_Send</I> event in the object model, and naturally presumed that was the right event to use. However, they started to notice that inconsistencies were occurring between items in Outlook and their database. Multiple-client issues aside, the problem is because of the event they used.</P>
<P>The Item_Send event fires when the user clicks the Send button on sendable items (Meeting requests, e-mail messages, etc). However, there are cases where the user can back out of sending the item after they click the send button. In this particular case, when a meeting is changed, the user is sometimes given a choice to send the updates to added/removed recipients, or to all recipients. If the user clicks cancel on this dialog, the send is canceled even though the Send event has fired.</P>
<P>To work around this issue, I instructed the developer to listen for the <I style="mso-bidi-font-style: normal">Application_ItemSend</I> event instead. This event fires after the user has committed to sending the message and ensures that the recipients on the item reflect the state of the item after the inspector has been closed.</P>
<P>Likewise, there is a Close event on each of the item classes, as well as a Close event on the Inspector object. To ensure that you inspect the contents of the item after all edits have occurred, catching the <I style="mso-bidi-font-style: normal">Inspector_Close</I> event will provide you with the best chance to see that information. After Item_Close has fired, there is still a chance the user will back out of the changes (for example, if they click No to save their changes).</P>
<P>There are times where using the Item_Close and Item_Send events are very useful though. For example, if you want to be able to cancel the event and prevent the item from being closed or sent, these events have a Cancel parameter which can be set to True to prevent the action from occurring. The more deterministic events on the Inspector and Application object are not cancelable, because that would affect their determinism.</P>]]></content:encoded>
    </item>
  </channel>
</rss>