<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Matt Barbour's Ramblings on CRM, USD and UII</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/mbarbour/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/mbarbour/feed.xml</link>
    <description>Here I share what I hope to be helpful bits of information regarding general Dynamics CRM User Interface Integration (UII), Unified Service Desk (USD) and Dynamics CRM\XRM development.</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:48:53 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How to fix building a strong type lib for CRM 7.1 (CRM 2015 Online Update 1) Errors</title>
      <link>https://docs.microsoft.com/archive/blogs/mbarbour/how-to-fix-building-a-strong-type-lib-for-crm-7-1-crm-2015-online-update-1-errors</link>
      <pubDate>Tue, 07 Jul 2015 17:04:01 GMT</pubDate>
      <dc:creator><![CDATA[MattB-MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mbarbour/2015/07/07/how-to-fix-building-a-strong-type-lib-for-crm-7-1-crm-2015-online-update-1-errors/</guid>
      <description><![CDATA[If your using an older version of the CrmSvcUtil.exe to generate a strongly typed lib for your...]]></description>
      <content:encoded><![CDATA[If your using an older version of the CrmSvcUtil.exe to generate a strongly typed lib for your projects,&nbsp; you may have noticed that it seems to have stopped working against CRM Online with the 7.1 update ( carina or CRM 2015 Online Update .1 ).&nbsp; Your probably seeing an error or errors that looks like this:&nbsp;

<h6>Failed to generate code for the service reference with 'https://schemas.microsoft.com/xrm/7.1/Metadata:ArrayOfEntityKeyMetadata' is not declared</h6>

If you happen to use Visual Studio to generate proxies via the Add Service process from the CRM endpoint, you may have seen it too. 

Ok Great,&nbsp; so you see the error, What the heck does that mean?!..

So long story short&hellip; We have been adding a lot of new objects to the API over the last several releases and have run into an interesting issue when dealing with WCF generated proxy&rsquo;s.&nbsp; We fixed it by adding version logic into the WSDL request for our connectors, that way they build the correct in memory proxy for the right version of SDK connected clients.&nbsp; That works quite well for things that use our SDK assemblies,&nbsp; but not so well for folks that are not using them, or are using some older versions of our tools. 

<h4>How to fix it.</h4>

For a while now we have supported a header in the CRM WCF API to identify the version of the SDK that is talking to it,&nbsp; this allows us to down-level the API to support older versions of the SDK assemblies,&nbsp; his header key is called sdkversion. 

You can also use sdkversion as a url param when creating proxy&rsquo;s for custom components or, as in the case with the CrmSvcUtil, older versions of some of our tools. 

For example,&nbsp; 

<blockquote>   If you are talking to a 7.1 deployment, and you want CRM to report the WSDL Info for a 7.1 compliant connection and generate a strong typed class, you would address the service as such via the CrmSvcUtil: </p>    <p><strong>CrmSvcUtil.exe</strong> /url:&rdquo;<strong>https://YOURORG.api.crm.dynamics.com/XRMServices/2011/Organization.svc?singleWSDL&amp;sdkversion=7.1</strong>&rdquo; /o:test.cs /n:test /u:ACCT@YOURORG.onmicrosoft.com /p:XXXXXXX</p> </blockquote>

<p>Notice that we added the <strong>?singleWSDL&amp;sdkversion=7.1 </strong>to the Url,&nbsp; this tells CRM that you are asking for the 7.1 version of the WSDL..&nbsp; that then allows the command to complete,&nbsp; the right metadata to come down, and you to have a class created as ( in this case ) test.cs that has all your strongly typed objects in it.

We will be updating the doc&rsquo;s for the CrmSvcUtil soon to reflect this,&nbsp; ( you can find those <a href="https://msdn.microsoft.com/en-us/library/gg695820.aspx">here</a> )

<p>Happy Crm&rsquo;ing</p>]]></content:encoded>
    </item>
    <item>
      <title>PowerShell via Xrm.Tooling.Connector and cleaning up USD Entities</title>
      <link>https://docs.microsoft.com/archive/blogs/mbarbour/powershell-via-xrm-tooling-connector-and-cleaning-up-usd-entities</link>
      <pubDate>Thu, 23 Apr 2015 12:50:00 GMT</pubDate>
      <dc:creator><![CDATA[MattB-MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mbarbour/2015/04/23/powershell-via-xrm-tooling-connector-and-cleaning-up-usd-entities/</guid>
      <description><![CDATA[So I found myself sitting in a USD training class the other day….   At the tail end of the Extreme...]]></description>
      <content:encoded><![CDATA[<h2>So I found myself sitting in a USD training class the other day…. </h2>  <p>At the tail end of the Extreme CRM conference in Madrid this last week ( 4/2015 ) I found myself sitting in a USD Training class, when a situation came up where a student had “broken” their deployment.&#160; Suffice to say that a bunch of records had been corrupted in such a way that it made sense to dump the USD data in the org and start over.&#160; </p>  <p>The easiest way that folks in the class came up with to fix this was to remove the USD solutions, which in turn removed the data for USD.&#160; The downside of that is that it takes a while to uninstall / reinstall solutions.&#160; </p>  <h2>PowerShell to the rescue</h2>  <p>As an odd happenstance,&#160; I had built a PowerShell script a few weeks before to clean up USD environments that I use when testing builds of USD. I turned it into a demo to show at the Dynamics Technical Conference with the intention of blogging it ( yea I know, long time between posts… ).&#160;&#160; And here I found an application for this. </p>  <h5>So what does this script do? </h5>  <p>As folks know (or may not know) we added a PowerShell cmdlet to CRM 2013 Sp1 ( 6.1) called Microsoft.Xrm.Tooling.Connector.Powershell. This cmdlet allows us to create an instance of the CrmServiceClient connector to CRM and use the functions of CRM from any given PowerShell script.&#160; With that I took advantage of a little know feature of the CRM API ‘s Bulk Delete capability to send multiple queries on one bulk delete request. </p>  <p>With that, the Bulk delete items and some defensive scripting,&#160; I end up with a script that will remove all the records from a USD configuration in one call to CRM</p>  <p>Run the command which prompts for login…    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/8524.image_0BC8525C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/8524.image_5F00_0BC8525C.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2627.image_thumb_4B28969D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2627.image_5F00_thumb_5F00_4B28969D.png" width="556" height="312" /></a></p>  <p>Answer the are you sure… really??????    <br /><strong><font color="#ff0000" size="2">THIS WILL WIPE OUT ALL OF YOUR USD CONFIG DATA WITH NO GOING BACK TO IT.</font></strong></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/5807.image_6F5081DD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/5807.image_5F00_6F5081DD.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0878.image_thumb_2C080A6E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0878.image_5F00_thumb_5F00_2C080A6E.png" width="563" height="139" /></a></p>  <p>You were warned and said ok anyway….    <br />Now you get to look at a status of this happening and contemplate if you picked the right environment while you wait…. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/8688.image_56E2FF31.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/8688.image_5F00_56E2FF31.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1881.image_thumb_762836B5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1881.image_5F00_thumb_5F00_762836B5.png" width="569" height="204" /></a></p>  <p>annnd volia !&#160; Empty USD Deployment </p>  <p>in this case, 1400 rows across 23 entities.&#160; … total time to run … about 1 min. </p>  <h2>So how do you do this? </h2>  <p>First you need to get the CRM SDK for 2015,&#160; I would recommend the 7.0.1 version or later as we solved a few issue with the –interactive flag of connector in later versions.&#160; you can get that <a href="https://www.microsoft.com/download/details.aspx?id=44567" target="_blank">here</a></p>  <p>Once you have that downloaded.. locate the “bin” directory.. that’s usually &lt;”yourInstallPath”&gt;\SDK\Bin</p>  <p>In that directory you will find a script called RegisterXrmTooling.ps1.&#160; You will need to run the script as an administrator in PowerShell so that it can do what it needs to do to register the connector.&#160; When you register it from this directory, you will likely get a message that says “<font color="#ff0000">Did Not Find Microsoft.Xrm.Tooling.PackageDeployment.Powershell.Dll</font>” that’s Ok for this task. you can ignore it. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/6518.image_1C8CAAB2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/6518.image_5F00_1C8CAAB2.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/5468.image_thumb_251009FC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/5468.image_5F00_thumb_5F00_251009FC.png" width="304" height="20" /></a></p>  <p>Once you have registered, you should be good to go..&#160; </p>  <p>You can also use that script to unregister the addin’s by passing the –Uninstall switch to it. </p>  <p>You can get the script I use <a href="https://1drv.ms/1yTUVOi" target="_blank"><strong>HERE</strong></a>.. *** No warrantees implied / treat it as samples and such *** </p>  <p>and be aware that THIS WILL WIPE OUT ALL OF YOUR USD CONFIG DATA WITH NO GOING BACK TO IT.</p>  <p>Happy CRMing and such. </p>]]></content:encoded>
    </item>
    <item>
      <title>Configuring Azure Service Bus endpoint and CRM Plugin Steps</title>
      <link>https://docs.microsoft.com/archive/blogs/mbarbour/configuring-azure-service-bus-endpoint-and-crm-plugin-steps</link>
      <pubDate>Fri, 03 Oct 2014 09:01:53 GMT</pubDate>
      <dc:creator><![CDATA[MattB-MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mbarbour/2014/10/03/configuring-azure-service-bus-endpoint-and-crm-plugin-steps/</guid>
      <description><![CDATA[Wow its been a while since I posted here;&#160; As most of you have seen, the Dynamics CRM world as...]]></description>
      <content:encoded><![CDATA[<p>Wow its been a while since I posted here;&#160; As most of you have seen, the Dynamics CRM world as been quite busy ( 3 Releases of CRM, Mobile apps, USD Added to the product, New Tools and such ) been a busy year or so.&#160; So folks,&#160; I apologize for being absent from the Blogging world. </p>  <p>To business, </p>  <p>Just the other day, I was doing some ad hoc testing on the new Plugin Registration Tool’s Service Buss endpoint configuration system and realized that the instructions in the CRM documentation and the tasks I needed to do were really confusing.&#160; Confusing to the point where I ended up going over to the API/SDK PM and asking how to get this to work..&#160; Now that’s not a good situation to be in.</p>  <p>After some discussion and going back and forth over the SDK Doc’s we came to the conclusion that really what was wrong was that terms CRM uses and Azure UX have changed over time between CRM and Azure.&#160; Also, Azure is innovating their portal / management tools so quickly that its hard for our doc’s to stay 100% current. </p>  <p>So here, I will walk though setting up a service bus endpoint that CRM can talk to.&#160;&#160; Start to finish.&#160; ( This is as of Sept 2014 <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1780.wlEmoticon-smile_719BA6B6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1780.wlEmoticon_2D00_smile_5F00_719BA6B6.png" />) </p>  <h4>Configuring Service Bus endpoint to work with a CRM Plugin Step.</h4>  <p>First you need to create your service bus endpoint to work with.&#160; </p>  <p><em><font style="background-color: #ffff00">Here is where I went wrong the first time.&#160; The Natural instinct here is to go to the Azure Management Portal and create your service bus endpoint there, then try to configured ACS.&#160; This will result in a service bus endpoint that you cannot easily integrate to CRM.&#160; <strong>So.. RESIST the urge</strong>, leave the management portal out of it for now..</font></em></p>  <p>The proper way to do it is actually described in one of our walkthrough in the SDK,&#160; <a href="https://msdn.microsoft.com/en-us/library/jj863635.aspx" target="_blank">here</a>.&#160;&#160; The confusing part about this walkthrough is that it is actually about configuration of the full Azure ACS Service to work with CRM vs. just setting up the a Service Bus Plugin endpoint.&#160;&#160; So you only need part of it.. </p>  <p>You will need to have the Azure PowerShell module,&#160; if you don’t have it installed, this part will not work.&#160; if you need to install it,&#160; here is a link to walk you though that process :&#160; <a href="https://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/" target="_blank">How to install and configure Azure PowerShell</a>.</p>  <p>Open up Windows PowerShell ISE ( or powershell of you like ) </p>  <p>Next type the command :&#160; Add-AzureAccount</p>  <p>This will pop a window that will walk you though Logging into your Azure Account. </p> <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/5751.image_3F37D337.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/5751.image_5F00_3F37D337.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/8468.image_thumb_3667CAEB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/8468.image_5F00_thumb_5F00_3667CAEB.png" width="593" height="210" /></a>   <p><font style="background-color: #ffff00"><em>*<strong>Important</strong>: If you have more the one Azure subscription,&#160; Make sure your on the right subscription for the next part,&#160; else your Service bus Endpoint may not get created where you expected it too.</em></font> </p>  <p>Next,&#160; Use the following command to create the Azure Service Bus: </p>  <p><strong>New-AzureSBNamespace</strong> &lt;YourNSName&gt; –Location &lt;Azure Region to live in&gt; </p>  <p>YourNSName is the name of your service bus endpoint,&#160; in my case its CrmExampleSb</p>  <p>For Location,&#160; Location can be any of the Azure Supported Regions, at the time of this post that list looked like:    <br /><em>Central US</em>, <em>East US</em>, <em>East US 2</em>, <em>North Central US</em>, <em>South Central US</em>, <em>West US</em>, <em>North Europe</em>, <em>West Europe</em>, <em>East Asia</em>, <em>Southeast Asia</em>, <em>Brazil South</em>, <em>Japan East</em>, and <em>Japan West</em>.</p>  <p>In my case, I used “West US”</p>  <p>This results in some information about your service bus, including the keys you will need in later steps. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2133.image_13C38C70.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2133.image_5F00_13C38C70.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2475.image_thumb_04ACAD96.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2475.image_5F00_thumb_5F00_04ACAD96.png" width="584" height="108" /></a></p>  <p>So this action creates the Service Bus endpoint, and the ACS service that you need integrate with CRM, all in one command. </p>  <p>Don’t close this window as you will need this information in a few min. </p>  <p>Now, We need to open up the Azure Management console as there is not a way currently via cmdlets to Create the queue </p>  <p>Open <a href="https://manage.azure.com">https://manage.azure.com</a> </p>  <p>Navigate to the service bus area and you should see your newly created service bus namespace:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0675.image_2AA25DEC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0675.image_5F00_2AA25DEC.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1680.image_thumb_6C0CEA78.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1680.image_5F00_thumb_5F00_6C0CEA78.png" width="581" height="367" /></a></p>  <p>Step into your new Namespace here and goto queues: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/7450.image_7D7D4B50.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/7450.image_5F00_7D7D4B50.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2275.image_thumb_043054D4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2275.image_5F00_thumb_5F00_043054D4.png" width="484" height="160" /></a></p>  <p>Click the create a new queue button and ( in this case ) use the Quick Create: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/8081.image_51CC8154.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/8081.image_5F00_51CC8154.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/5270.image_thumb_10BE01F0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/5270.image_5F00_thumb_5F00_10BE01F0.png" width="581" height="336" /></a></p>  <p>In this case, I called my queue “OutChannel”</p>  <p>Ok, So now we are all set on the service bus side… now we just need to create our Plugin Step Registration to talk to it. </p>  <h4>Creating an Azure Service Endpoint in the Plugin Registration tool </h4>  <p>Start up the Plugin Registration tool, You can find that tool in the tools directory of the CRM SDK. </p>  <p>Using the Plugin Registration Tool,&#160; Login to the CRM Deployment you want to set up the step in. </p>  <p>In my case, I am going to use CRM Online as that has all the CRM service side bits of the Azure interface preconfigured and ready to go. </p>  <p>Here I have started the Plugin Registration Tool and connected it to an organization called CvgUsdDemo</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0027.image_5AD90CD5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0027.image_5F00_5AD90CD5.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1425.image_thumb_2155FCDE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1425.image_5F00_thumb_5F00_2155FCDE.png" width="584" height="340" /></a></p>  <p>Now I want to click the dropdown button called “register” and then choose “Register new Service Endpoint”</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/6811.image_5275377E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/6811.image_5F00_5275377E.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/6747.image_thumb_46071455.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/6747.image_5F00_thumb_5F00_46071455.png" width="584" height="289" /></a></p>  <p>That opens up my step registration form. </p>  <p>Here is where we use the information we created via Powershell and the Azure Management portal</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1563.image_4C4DEAE3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1563.image_5F00_4C4DEAE3.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/8345.image_thumb_3E0F71F3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/8345.image_5F00_thumb_5F00_3E0F71F3.png" width="585" height="450" /></a></p>  <p><strong>Name</strong> is my name for the service endpoint for CRM.&#160; This is what CRM will describe it as.     <br /><strong>Solution Namespace</strong> is the Service bus endpoint name.&#160; so in my examples here,&#160; that would be <strong>CrmExampleSb</strong>     <br /><strong>Path</strong> is the queue we created in the Management Portal,&#160; so in my example here,&#160; that’s <strong>outchannel</strong>     <br /><strong>Contract</strong> is a bit tricky.&#160; Depending one the type of item you put in the Service Bus your options here change.. in my case, I created a queue, which allows me to use either <em><strong>PresistentQueue</strong></em> or <strong><em>Queue</em></strong> for this field.&#160; If I try to do something else, I will get an error.     <br /><strong>Claim</strong> is really short hand for: add the user context info or not to the message on the service bus. </p>  <p>Now, I click Save and Configure ACS, </p>  <p>The Plugin Registration Tool does most of the heavy lifting here for configuring security and such.&#160; however it does need a few things from you to do it. </p>  <p>This step requires information from 2 places, </p>  <p>First you will need to go to your CRM developer settings are to get the Certificate for CRM and the Issuer Name for the Certificate.&#160; For CRM Online, this is all preconfigured for you when your CRM online instance is created, for CRM on premise, you will need to set this up in your deployment before you can do this next step.&#160; </p>  <p>In the Plugin Registration Tool, we provide a link right on the Configure ACS page for you to get to this info in CRM</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0456.image_6EC2799E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0456.image_5F00_6EC2799E.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/7183.image_thumb_437DE297.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/7183.image_5F00_thumb_5F00_437DE297.png" width="457" height="382" /></a></p>  <p>so in my case, This info looks like this: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4075.image_7C288CA4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/4075.image_5F00_7C288CA4.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4174.image_thumb_1BD7666D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/4174.image_5F00_thumb_5F00_1BD7666D.png" width="465" height="452" /></a></p>  <p>The two things I need here are the Issuer Name, and the certificate. </p>  <ol>   <li>Take note of the Issuer Name </li>    <li>Download the certificate to your workstation. </li> </ol>  <p>Second you will need the management key for the service bus,&#160; the PowerShell command to create the service bus reported that key.</p>  <p>Back in the PowerShell output (from creating the service bus) that’s called the “defaultkey” </p>  <p>so populated,&#160; my form looks like this: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1768.image_7430EA42.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1768.image_5F00_7430EA42.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4428.image_thumb_48EC533B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/4428.image_5F00_thumb_5F00_48EC533B.png" width="488" height="405" /></a></p>  <p>Next, you push the configure ACS button. </p>  <p>You will get a warning here, </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/7658.image_0196FD49.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/7658.image_5F00_0196FD49.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/6014.image_thumb_6C3947E0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/6014.image_5F00_thumb_5F00_6C3947E0.png" width="466" height="229" /></a></p>  <p>Click Yes and wait… </p>  <p>when complete.. you will see a report indicating that it worked or didn’t work..&#160; in this case, working looks like this: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/7178.image_59844E29.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/7178.image_5F00_59844E29.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4073.image_thumb_07056DED.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/4073.image_5F00_thumb_5F00_07056DED.png" width="466" height="488" /></a></p>  <p>The final step, is to close this window and then click the Save and Verify Authentication button on the Service Endpoint Registration page. </p>  <p>it should take a moment to complete.. and when complete you should be presented with a screen like this:&#160; </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2620.image_3890DB82.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2620.image_5F00_3890DB82.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1261.image_thumb_3F43E505.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1261.image_5F00_thumb_5F00_3F43E505.png" width="463" height="358" /></a></p>  <p>If you got here,&#160; you are good to go. </p>  <p>Click Close, then save the Service Endpoint Registration. </p>  <p>Your new endpoint now shows in the “Registered Plugins and Custom Workflow Activities” list. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/8611.image_179D68DB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/8611.image_5F00_179D68DB.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/7077.image_thumb_25037BE1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/7077.image_5F00_thumb_5F00_25037BE1.png" width="617" height="280" /></a></p>  <h4>Creating an Step Registration for the new Service Endpoint in the Plugin Registration tool </h4>  <p>Now you just need to wire the events you want to listen too the service endpoint. </p>  <p>Right Click on the Service Endpoint and choose “Register New Step” </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1220.image_4F6FACFE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1220.image_5F00_4F6FACFE.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1157.image_thumb_4F037A09.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1157.image_5F00_thumb_5F00_4F037A09.png" width="616" height="305" /></a></p>  <p>That then opens this UX: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/5857.image_430189D5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/5857.image_5F00_430189D5.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3125.image_thumb_429556E0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3125.image_5F00_thumb_5F00_429556E0.png" width="627" height="396" /></a></p>  <p>As you can see the event handler is already set to the service endpoint,&#160; now all we need to do is configure the Message we care about and the entity to act on… so in my case,&#160; Create of Account and post messages Async: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/8030.image_2D37A178.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/8030.image_5F00_2D37A178.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/6470.image_thumb_688B0736.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/6470.image_5F00_thumb_5F00_688B0736.png" width="638" height="403" /></a></p>  <p>Then click “register new step” and volia .. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3568.image_2135B144.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3568.image_5F00_2135B144.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0878.image_thumb_27E8BAC7.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0878.image_5F00_thumb_5F00_27E8BAC7.png" width="646" height="328" /></a></p>  <p>Any new Accounts will also get sent to the Azure Service bus queue we configured for that end point. </p>]]></content:encoded>
    </item>
    <item>
      <title>Support and SDK info Released for CRM codename Orion</title>
      <link>https://docs.microsoft.com/archive/blogs/mbarbour/support-and-sdk-info-released-for-crm-codename-orion</link>
      <pubDate>Mon, 17 Jun 2013 20:30:53 GMT</pubDate>
      <dc:creator><![CDATA[MattB-MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mbarbour/2013/06/17/support-and-sdk-info-released-for-crm-codename-orion/</guid>
      <description><![CDATA[The CRM Team blog just posted an update to the implementation planning guide and to the SDK that...]]></description>
      <content:encoded><![CDATA[<p>The CRM Team blog just posted an update to the implementation planning guide and to the SDK that cover a number of important things to know about the next major Microsoft Dynamics CRM release.. <p>You can find more here </p><p>CRM TEAM BLOG: <font size="4"><a href="https://blogs.msdn.com/b/crm/archive/2013/06/17/what-s-changing-in-the-next-release.aspx">What&rsquo;s Changing in the Next Release?</a></font></p><p>Head over and check it out. </p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Visual Studio Solution Starters and Templates for CCAUII</title>
      <link>https://docs.microsoft.com/archive/blogs/mbarbour/visual-studio-solution-starters-and-templates-for-ccauii</link>
      <pubDate>Fri, 15 Jun 2012 13:11:53 GMT</pubDate>
      <dc:creator><![CDATA[MattB-MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mbarbour/2012/06/15/visual-studio-solution-starters-and-templates-for-ccauii/</guid>
      <description><![CDATA[This is an update of an article I wrote in 2010,&#160; that is now up to date with the current...]]></description>
      <content:encoded><![CDATA[<p><em>This is an update of an article I wrote in 2010,&#160; that is now up to date with the current solution starter package. </em></p>  <p>Picking though the examples and documentation for UII to figure out how to setup your first ( or 10th ) hosted control, adapter, or CTI adapter is a bit of a pain. Not to mention a bit time consuming… most of the time in the CCF Days, I would just grab another control I had written and use it as the ‘boiler plate’ for doing what ever I needed to do. </p>  <p>As we put together internal and partner training for CCA\UII for CRM 4, I took the time to create a few project starters for things that I do a lot, such as Creating Hosted Controls, or Search controls and CTI adapters. Those of you that have attended the CCA training events will have seen one of them already as we use templates in module 3 of the training.&#160; </p>  <p>I had made prior versions of these templates available to folks via a VSI file on sky drive,&#160; the major issue with this delivery channel is that I don’t have a clear idea as to how valuable they are to folks or a means to keep folks up to date as a fix and publish updates. </p>  <p>To address that, I have made these solution starters available via the Visual Studio Gallery for folks to use, the limitation is that you must be doing development on Visual Studio 2010 or newer to utilize these templates.&#160; This will also allow me to keep things up to date as necessary </p>  <p>You can download them from the Visual Studio Extensions manager by searching for UII , CCA or CRM or by clicking <a href="https://visualstudiogallery.msdn.microsoft.com/1a874843-e67e-4d76-a9f0-0a3107a5a016" target="_blank">here</a>. </p>  <p><strong>Change Log:</strong> </p>  <p><strong><em>Ver 2.0 – 6/15/12</em></strong> </p>  <ul>   <li>Updated Default sizing on WPF Controls to use “design” sizing vs actual sizing in the templates. </li>    <li>Agent Desktop Template :      <ul>       <li>Major updates to the connection manager in the agent desktop to support office 365 and token renewal&#160; - in general this can be patched into your desktop by copying the CrmConnect folder to your project from a new desktop project built from the template. ( Updating namespaces as necessary ) </li>        <li>Added sorting of organizations when choosing orgs. </li>        <li>Added a cancel link on the splash screen. </li>     </ul>   </li>    <li>CTI Starter Solution      <ul>       <li>Added all created projects to a sub solution folder to support multiple CTI projects in one base solution. </li>     </ul>   </li> </ul>  <h3>&#160;</h3>  <h3>What templates are provided</h3>  <p>I am providing 8 project templates and 6 item templates for use with UII</p>  <p>Project and Item Templates: </p>  <ul>   <li><strong>UII Application Adapter Control</strong>      <ul>       <li>This provides a base project template for creating an application adapter </li>     </ul>   </li>    <li><strong>UII Web Application Adapter Control</strong>      <ul>       <li>This provides a base project template for creating an web adapter. Note: this is not a HAT control,&#160; the Web Application Project type creates a HAT control </li>     </ul>   </li>    <li><strong>UII Windows Form Hosted Control</strong>      <ul>       <li>This provides a base project template for creating an winform hosted control with the session, doaction handlers, and context handers prewired. </li>     </ul>   </li>    <li><strong>UII WPF Hosted Control</strong>      <ul>       <li>This provides a base project template for creating an wpf hosted control with the session, doaction handlers, and context handers prewired. </li>     </ul>   </li>    <li><strong>UII Windows Form Customer Search Control</strong>      <ul>       <li>This provides a base project template for creating an winform hosted control with the session, doaction handlers, context, session creation, and search logic handers prewired. It also supplies a base customer payload class. </li>     </ul>   </li>    <li><strong>UII WPF Customer Search Control</strong>      <ul>       <li>This provides a base project template for creating an wpf hosted control with the session, doaction handlers, context, session creation, and search logic handers prewired. It also supplies a base customer payload class. </li>     </ul>   </li> </ul>  <p>Project Only Templates:</p>  <ul>   <li><strong>UII Baseline Agent Desktop</strong>      <ul>       <li>As the name implies, it is a baseline agent desktop shell, with 5 hosting areas, a hidden area , a CrmConnection manager, about window, and splash screen.&#160; It supports all methods of login to CRM including federated.&#160;&#160; This desktop is functioning standalone, and provides code level documentation as to what it is doing. </li>     </ul>   </li>    <li><strong>UII CTI Starter Solution</strong>      <ul>       <li>This solution lays out all the base components necessary to create a CTI adapter for UII. </li>        <li>Within this solution:          <ul>           <li>The <strong>BaseCitConnector </strong>project is the communication layer for talking to the downstream CTI solution. This control is setup to talk to the CTI solution via polling, however it can be adapted to whatever you need. </li>            <li>The <strong>BaseCitDesktopManager</strong> is the Interface layer that UII uses to manage events between UII and the BaseCTIConnector, it is also the control that instances the AgentState and CallState Manager Classes in the next assembly. </li>            <li>The <strong>BaseCtiStateManagers</strong> are the translators for CTI =&gt; CCA and places where you can add extended functionality beyond the core control set we offer. </li>         </ul>       </li>     </ul>   </li> </ul>  <h3>How to install it. </h3>  <p>You can download them from the Visual Studio Extensions manager by searching for UII , CCA or CRM or by clicking <a href="https://visualstudiogallery.msdn.microsoft.com/1a874843-e67e-4d76-a9f0-0a3107a5a016" target="_blank">here</a>. </p>  <p>When you begin the install you will be presented with a window that looks like this: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4201.image_1A855EC1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/4201.image_5F00_1A855EC1.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0474.image_thumb_7991EC19.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0474.image_5F00_thumb_5F00_7991EC19.png" width="415" height="312" /></a></p>  <p>You will notice that the message “<strong>This extension does not contain a digital signature</strong>” is present. </p>  <p>This is normal, as I have not signed this package. </p>  <p>Push Install to complete the install,&#160; after which you will be presented with a dialog that looks like this: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1464.image_0A9619FD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1464.image_5F00_0A9619FD.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/7824.image_thumb_70C1E3CD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/7824.image_5F00_thumb_5F00_70C1E3CD.png" width="414" height="310" /></a></p>  <p>You can verify that everything went fine by opening up VS and Clicking the “New Project”. Under Visual C# you will see a area called <strong>UII </strong></p>  <p>In that section you will see 10 project templates that looks like this ( if you also have HAT Installed, otherwise you will see only 8 ) </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/8715.image_08E54E29.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/8715.image_5F00_08E54E29.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2626.image_thumb_60666C14.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2626.image_5F00_thumb_5F00_60666C14.png" width="514" height="336" /></a></p>  <h4>&#160;</h4>  <h4>Important Notes..</h4>  <p>I have provided the templates in Visual C# only. You will not find them in the VB.net area of Visual Studio </p>  <p>All of the templates configured with “local” references to the UII framework directory, which means you will need to update the References Paths to point to the UII Install Directory \ Framework directory. </p>  <p>To Do that, </p>  <p>Right click on the project in the solution explore and choose “properties”:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0044.image_602F37C3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-25-22-metablogapi/0044.image_5F00_602F37C3.png"><img title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/6646.image_thumb_186DAEDC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-25-22-metablogapi/6646.image_5F00_thumb_5F00_186DAEDC.png" width="226" height="420" /></a></p>  <p>then choose the “Reference Paths” from the project areas:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/6327.image_575F2F77.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-25-22-metablogapi/6327.image_5F00_575F2F77.png"><img title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0385.image_thumb_68CF904F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-25-22-metablogapi/0385.image_5F00_thumb_5F00_68CF904F.png" width="244" height="115" /></a></p>  <p>Next, Click the … button next the folder box, and Navigate to your UII Install Directory. If you used the default install that’s going to be <em>C:\Program Files\Microsoft Uii\Framework</em></p>  <p>Once you have selected the folder, click “Add Folder” under the Folders box. </p>  <p>That should fix all the reference problems and you should be good to go. </p>  <p>I hope folks find this useful, Please post comments on the <a href="https://visualstudiogallery.msdn.microsoft.com/1a874843-e67e-4d76-a9f0-0a3107a5a016" target="_blank">Gallery site</a> , <a href="https://social.microsoft.com/Forums/en-US/crmlabs/threads" target="_blank">MSDN forums</a> , <a href="https://crmcca.codeplex.com/discussions" target="_blank">codeplex</a> or as comments here. </p>  <p>Happy coding. </p>]]></content:encoded>
    </item>
    <item>
      <title>Adding and triggering custom audit events in CCAUII</title>
      <link>https://docs.microsoft.com/archive/blogs/mbarbour/adding-and-triggering-custom-audit-events-in-ccauii</link>
      <pubDate>Tue, 28 Feb 2012 07:10:13 GMT</pubDate>
      <dc:creator><![CDATA[MattB-MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mbarbour/2012/02/28/adding-and-triggering-custom-audit-events-in-ccauii/</guid>
      <description><![CDATA[As most folks who work with CCA\UII know,&#160; UII has its own auditing system that audits events...]]></description>
      <content:encoded><![CDATA[<p>As most folks who work with CCA\UII know,&#160; UII has its own auditing system that audits events for the agent desktop.&#160; I recently was asked how to go about adding a custom audit event and storing that information in UII’s audit system. </p>  <h3>Audit events shipped with UII</h3>  <p>These are events that are installed by default… by default they are all disabled.&#160; To enable, you need to flip the bits in the UII Options entity to 1 for the events your interested in.</p>  <p>   <table border="1" cellspacing="0" cellpadding="2" width="495"><tbody>       <tr style="background-color: #0000ff; color: #ffffff">         <td valign="top" width="175"><strong>Flag Name</strong></td>          <td valign="top" width="318"><strong>What it does</strong></td>       </tr>        <tr>         <td valign="top" width="180"><strong>AuditFlagAction</strong></td>          <td valign="top" width="314">Raised when an action is called on a hosted control</td>       </tr>        <tr>         <td valign="top" width="184"><strong>AuditFlagAgentState</strong></td>          <td valign="top" width="311">Raised when the CTI State of an agent changes </td>       </tr>        <tr>         <td valign="top" width="187"><strong>AuditFlagHostedApplication</strong></td>          <td valign="top" width="308">Raised when a hosted application changes or is loaded</td>       </tr>        <tr>         <td valign="top" width="190"><strong>AuditFlagInteraction</strong></td>          <td valign="top" width="306">Can be raised by a developer code as necessary</td>       </tr>        <tr>         <td valign="top" width="192"><strong>AuditFlagLogin</strong></td>          <td valign="top" width="305">Raised when a UII Login or Logout event occurs</td>       </tr>        <tr>         <td valign="top" width="193"><strong>AuditFlagSession</strong></td>          <td valign="top" width="304">Raised when a session is changed, loaded or closed.</td>       </tr>        <tr>         <td valign="top" width="194"><strong>AuditFlagWorkFlow</strong></td>          <td valign="top" width="303">Raised when the onboard workflow system is used with state information on the workflow</td>       </tr>     </tbody></table> </p>  <p>So that’s great,&#160; Now how to I add my OWN events. </p>  <h3>Adding an audit event to catch the desktop shutdown.</h3>  <p>Lets say I want to log the desktop shutdown,&#160; as you can see that’s not covered in the out of the box list.&#160; Lets add it. </p>  <h6>Right Way vs Just getting it done…</h6> As with most things in coding,&#160; there are multiple ways to do something, UII is no different.&#160; in this case, I'm going to cover what I suggest is the correct way to add in a log event and provide a means for the operations folks that come behind you to maintain it and switch it.   <p>First thing to do is add a new value to the UII Options table,&#160; lets call this value &quot;<strong>AuditFlagDesktopShutdown</strong>”.     <br />Goto Settings –&gt; UII Options.&#160; Press the new button and add the entry as it appears below.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3240.image_443E855B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3240.image_5F00_443E855B.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2350.image_thumb_51A49861.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2350.image_5F00_thumb_5F00_51A49861.png" width="447" height="26" /></a></p>  <p>Ok now to our Agent desktop code, </p>  <p>In the agent UiiServices class,&#160; locate the method “<strong>BeforeDesktopClose</strong>”</p>  <p>Add this code to it </p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; height: 369px; max-height: 300px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #008000">// Generally this part is done in your desktop setup,  I'm doing it here for readability </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #008000">// this is the name of my config key.</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">string</span> myKey = <span style="color: #006080">&quot;AuditFlagDesktopShutdown&quot;</span>;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #008000">// this gets the current value from the UII Options entity</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">string</span> sValue = ConfigurationReader.ReadAppSettings(myKey);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #008000">// this sets the audit state for that key</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> AuditLog.SetAuditFlag(myKey, sValue);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #008000">// This part occurs at the time of the event. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> <span style="color: #008000">// this creates the data payload for the audit event,</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> Microsoft.Uii.Common.Entities.LogData data = <span style="color: #0000ff">new</span> Microsoft.Uii.Common.Entities.LogData()</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     Action = <span style="color: #006080">&quot;DesktopShutdown&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     ActionData = <span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;Desktop Shutdown event at {0}&quot;</span>, DateTime.Now.ToString())</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span> };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span> <span style="color: #008000">// this raises the audit event. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span> AuditLog.Log(myKey, data); </pre>
<!--CRLF--></div>
</div>

<p>This code is broken into two parts. The first part is the setup and registration of the audit key in the desktop. Where the call to ConfigurationReader.ReadAppSettings is reading the key from the UII Options entity. </p>

<p>The set command registers it with UII for future use.&#160; as such you only need to do this part once at the start of your desktop normally.&#160; Once this is done, UII will respect the audit setting and either log or not log the event based on the setting. </p>

<p>The second part is where the actual log event occurs. </p>

<p>Once that is done you can use an Advanced find to locate the and see the UII Audit entity in CRM.</p>

<p>For clarity sake,&#160; my UII Options entity looks like this : </p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0513.image_033005F7.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0513.image_5F00_033005F7.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4401.image_thumb_1E685EF8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/4401.image_5F00_thumb_5F00_1E685EF8.png" width="376" height="295" /></a></p>

<p>Happy Coding. </p>]]></content:encoded>
    </item>
    <item>
      <title>CRM 2011 Prepopulating Opportunity and Quote Price List, Unit and Quantity.</title>
      <link>https://docs.microsoft.com/archive/blogs/mbarbour/crm-2011-prepopulating-opportunity-and-quote-price-list-unit-and-quantity</link>
      <pubDate>Wed, 01 Feb 2012 16:45:45 GMT</pubDate>
      <dc:creator><![CDATA[MattB-MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mbarbour/2012/02/01/crm-2011-prepopulating-opportunity-and-quote-price-list-unit-and-quantity/</guid>
      <description><![CDATA[Recently I've been presented a number of scenarios where the built in CRM Opportunity and Quoting...]]></description>
      <content:encoded><![CDATA[<p>Recently I've been presented a number of scenarios where the built in CRM Opportunity and Quoting modules are very close to what is needed for a given customer requirement.&#160; However the process does not need or really want to use pricelist, Unit or quantity for a product on the Opportunity or Quote.. </p>  <h4>So the challenge… </h4>  <p>My scenario calls for using the product’s with Opportunities and Quotes to support the forecasting and quota modules,&#160; however I don’t have any complexity in my product catalog. Its is a flat list of products with flexible pricing and quantity support.&#160; I do not need more then one pricelist, nor do I need multiple Unit specifications. </p>  <p>to support this,&#160; lets say we have defined a product called PROD001,&#160; PROD001 is on the Default Price List, with a Price List Cost of $10.&#160; It is also associated to the Primary Unit, with a default quantity of 1.&#160;&#160; <br /></p>  <p>The Product looks like:    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0245.image_58A0CCE4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0245.image_5F00_58A0CCE4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/6014.image_thumb_37AD5A3D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/6014.image_5F00_thumb_5F00_37AD5A3D.png" width="392" height="360" /></a></p>  <p>The Primary Unit looks like:    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1715.image_4FD0C498.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1715.image_5F00_4FD0C498.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0638.image_thumb_0B242A57.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0638.image_5F00_thumb_5F00_0B242A57.png" width="335" height="261" /></a></p>  <p>Remember that Default Unit “owns” the Primary Unit…</p>  <p>And on the Default Price List I have a Price List Item    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4530.image_5C5E71B4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/4530.image_5F00_5C5E71B4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3343.image_thumb_69C484BA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3343.image_5F00_thumb_5F00_69C484BA.png" width="496" height="165" /></a></p>  <p>Which looks like :    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0724.image_3AFECC18.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0724.image_5F00_3AFECC18.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2352.image_thumb_4145A2A6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2352.image_5F00_thumb_5F00_4145A2A6.png" width="495" height="245" /></a></p>  <p>Now I want to create a Opportunity….&#160; Using the default functionality; I go to Sales, Opportunities, and click “New”,&#160; I populate the Topic and Customer and click save…    <br />Now I navigate to the Line items area..</p>  <p>My view looks like this:    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/5187.image_127FEA04.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/5187.image_5F00_127FEA04.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2450.image_thumb_5890A717.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2450.image_5F00_thumb_5F00_5890A717.png" width="493" height="226" /></a></p>  <p>On the Ribbon, I click “Add New Opportunity Product”… </p>  <p>I am promptly given an Error:    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1781.image_29CAEE75.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1781.image_5F00_29CAEE75.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/8132.image_thumb_28F2888B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/8132.image_5F00_thumb_5F00_28F2888B.png" width="489" height="337" /></a></p>  <p>Ok, So I need to:</p>  <ol>   <li>Click the search box next to Price List ( or type it in if I know the name ). </li>    <li>Choose the Default price List in the Lookup. </li>    <li>Click Save. </li>    <li>THEN save the form </li> </ol>  <p>All to get me this view:    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4503.image_7CD58B99.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/4503.image_5F00_7CD58B99.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1263.image_thumb_031C6228.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1263.image_5F00_thumb_5F00_031C6228.png" width="489" height="298" /></a></p>  <p>That’s a lot of work for a field I didn’t care about…</p>  <p>So now Im ready to add a product,&#160; Once Again I click “Add New Opportunity Product”…    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2402.image_064E4A10.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2402.image_5F00_064E4A10.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1325.image_thumb_5A9D8013.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1325.image_5F00_thumb_5F00_5A9D8013.png" width="487" height="263" /></a></p>  <p>I click the search button on the existing product and Select PROD001</p>  <p>Now I have this..    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2425.image_2BD7C771.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2425.image_5F00_2BD7C771.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/7776.image_thumb_321E9DFF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/7776.image_5F00_thumb_5F00_321E9DFF.png" width="481" height="254" /></a></p>  <p>Ok, so I can see by the Red * that I need a Unit and a Quantity to proceed. </p>  <p>So again.. I need to Click the Search button and Populate the unit, then key the quantity I'm interested in..&#160; THEN hit save. </p>  <p>The net result is I get back to this:    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/%.image_31463815.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2500.image_5F00_31463815.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/5226.image_thumb_378D0EA3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/5226.image_5F00_thumb_5F00_378D0EA3.png" width="483" height="345" /></a></p>  <p>Looking back at the overall flow here,&#160; Iv got perhaps 3 save’s and 9+ clicks I need to do to enter information that is repeated every time and my user doesn't really care about anyway…&#160;&#160; Not a good situation… </p>  <h4>Solving for Required, but Ignored fields.&#160; </h4>  <p>The obvious answer is to remove them from the form, however that not going to work as they are required for the “normal” function of CRM.&#160; </p>  <p>After giving this a bit of though I came up with a solution that prepopulates most of this “Extra” information from defaults, which allows you to hide the fields in question and still leverage the core features of CRM’s product / Opportunity and Quoting modules. </p>  <p>While I could hard code in ID’s or names to a Onload JavaScript for the various forms,&#160; I want to give the developer and user the flexibility to configure the default pricelist, and the relationships for the Product / Unit and quantity that will auto populate.&#160;&#160; My thinking here is while these fields are not necessary in the day to day operations, they can be used to speed data entry and reporting. </p>  <p>So the plan was to be able to create a relationship such as : </p>  <ul>   <li>PROD001 (Product)</li>    <ul>     <li>Primary Unit&#160; ( Unit Relationship )</li>      <ul>       <li>Quantity: 1</li>     </ul>   </ul>    <li>PROD002 (Product)</li>    <ul>     <li>Batch (Unit Relationship )</li>      <ul>       <li>Quantity: 10</li>     </ul>   </ul>    <li>Default ( PriceList)</li>    <ul>     <li>PriceList Item for PROD001</li>      <ul>       <li>Product : PROD001 </li>        <li>Amount: $10</li>     </ul>      <li>PriceList Item for PROD002</li>      <ul>       <li>Product : PROD002</li>        <li>Amount: $15</li>     </ul>   </ul> </ul>  <p>and so on..&#160;&#160; This way the user can set the default quantity behavior for any given product by adjusting the default Unit on the product.    <br />Note:&#160; the relationship from the PRODUCT to the UNIT is the determining relationship in this process, not the relationship on the pricelist, </p>  <p>What I chose to do was to create a JavaScript module that did the following: </p>  <p>On Create Opportunity and Quote:</p>  <blockquote>   <p>If the Price List is not populated already, Use a hint key to populate the Price List from the system.. by default its going to look for a pricelist that starts with “Default”</p> </blockquote>  <p>On Add Product to Opportunity Product or Quote Line Item</p>  <blockquote>   <p>Use the default association between Product, Unit, and Unit quantity to populate the appropriate fields on the form.      <br />this allows the user to configure the default unit and quantity numbers on a per product bases. IE: Each / Batch / etc..</p> </blockquote>  <p><em><strong>JavaScript vs a Plugin,        <br /></strong></em><em>I did consider using a plugin to associate the default pricelist with an Opportunity or Quote, but decided to keep it all in the front end for now.</em></p>  <p>This functionally drops 9 or so Clicks and 3 save actions along the way… which balances things out a bit. </p>  <p>You can find the Managed and Unmanaged solutions that contains the JavaScript web resource to do this job <a href="https://skydrive.live.com/redir.aspx?cid=5a34cce9728c8f4f&amp;resid=5A34CCE9728C8F4F!208&amp;parid=5A34CCE9728C8F4F!169&amp;authkey=!AGBHEI_8dMiRdbI" target="_blank">here</a>.     <br />There are 2 web resources in the solution, </p>  <ul>   <li>mattb_ProductViewSettings </li>    <li>mattb_ProductViewSettings_UnCompressed </li> </ul>  <p>They are both the same file,&#160; one is minimized, one is not. </p>  <p>Additionally I have provided the opportunity, quote, opportunity product, and quote line item form event updates as part of the solution.   <br /><font size="2"><strong>When in doubt, use the managed solution</strong>.</font> </p>  <p><strong><font size="2">Warnings: </font></strong></p>  <p><strong><font size="2">Note: If you import the Managed solution and maintain the existing customizations ( Don’t step on the forms there if they are customized ), you will need to add in these events by hand.</font></strong></p>  <p><strong><font size="2">If you don’t know if your opportunity / quote forms are customized… use the managed solution …&#160; </font></strong></p>  <p>You can always copy the JavaScript code out of the mattb_productViewSettings_UnCompressed in the managed solution and add it to a web resource in your solution. </p>  <p>As provided, the JavaScript will look for any pricelist that begins with the word “Default”,&#160; and if there is more then one, use the first one in runs into.   <br />To change that, open the web resource and locate the line :     <br /></p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> DefaultPriceListStartsWith: <span style="color: #006080">&quot;Default&quot;</span>,</pre>
<!--CRLF--></div>
</div>



<p>Then change the world Default to whatever you want the default price list to be..</p>

<p>For Opportunity and Quote, the form properties are wired to events as such : 
  <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1817.image_48913C86.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1817.image_5F00_48913C86.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3157.image_thumb_7CC565CC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3157.image_5F00_thumb_5F00_7CC565CC.png" width="473" height="462" /></a></p>

<p>Where <strong>mattb_ProductViewSettings</strong> has been added to the forms library collection and the <strong>Onload</strong> event has been wired to the <strong>MattB.ProductViewSettings.OppQuoteDefaultPriceList</strong> method of the <strong>mattb_ProductViewSettings</strong>. </p>

<p>For the Line item forms., </p>

<p>The Form properties are set to: 
  <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/6281.image_5BD1F325.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/6281.image_5F00_5BD1F325.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3051.image_thumb_4D274740.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3051.image_5F00_thumb_5F00_4D274740.png" width="471" height="442" /></a></p>

<p>and the properties on the “product” field have been set to: 
  <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3146.image_13380454.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3146.image_5F00_13380454.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3531.image_thumb_048D586F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3531.image_5F00_thumb_5F00_048D586F.png" width="480" height="526" /></a></p>

<p>So in text:&#160; <br /><strong>mattb_ProductViewSettings</strong> has been added to the forms library collection of the Quote Line Item and Opportunity Line Item, Then I viewed properties on the Existing Product field, selected events, and added <strong>MattB.ProductViewSettings.ProductDefaultUom </strong>to the OnChange event</p>

<p>with that done, </p>

<p>When I create a new opportunity,&#160; the Price List is auto populated and saved on the first save, which I need to do to activate the line items area. 
  <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3542.image_3C32430B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3542.image_5F00_3C32430B.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3051.image_thumb_148BC6E1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3051.image_5F00_thumb_5F00_148BC6E1.png" width="472" height="164" /></a></p>

<p>And when I click “Add New Opportunity Product”&#160; and select a product 
  <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3146.image_48BFF027.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3146.image_5F00_48BFF027.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/2860.image_thumb_3A154442.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/2860.image_5F00_thumb_5F00_3A154442.png" width="473" height="237" /></a></p>

<p>Unit and quantity auto populate…&#160; </p>

<p>Also because Unit is driving the base quantity, if I choose a product with a different unit: 
  <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4617.image_20410E13.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/4617.image_5F00_20410E13.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/6254.image_thumb_2687E4A1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/6254.image_5F00_thumb_5F00_2687E4A1.png" width="473" height="235" /></a></p>

<p>It populates the updated quantity based on the unit associated. </p>

<p>There we go… a bit of prepopulating to help get things moving a bit faster and save some mouse clicks and key strokes. </p>

<p>Enjoy!.</p>]]></content:encoded>
    </item>
    <item>
      <title>How to override the CRM 2011 popup alert in CCA when redirecting a popup *Update*</title>
      <link>https://docs.microsoft.com/archive/blogs/mbarbour/how-to-override-the-crm-2011-popup-alert-in-cca-when-redirecting-a-popup-update</link>
      <pubDate>Tue, 31 Jan 2012 05:48:58 GMT</pubDate>
      <dc:creator><![CDATA[MattB-MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mbarbour/2012/01/31/how-to-override-the-crm-2011-popup-alert-in-cca-when-redirecting-a-popup-update/</guid>
      <description><![CDATA[This is an update to a prior blog post here  How to stop the CRM Popup alert when you grab a window...]]></description>
      <content:encoded><![CDATA[<p>This is an update to a prior blog post <a href="https://blogs.msdn.com/b/mbarbour/archive/2010/11/22/how-to-override-the-crm-4-0-popup-alert-in-cca-when-redirecting-a-popup.aspx" target="_blank">here</a></p>  <p>How to stop the CRM Popup alert when you grab a window and re-host it to another tab, while suppressing the OnNewWindow event is a common issue that developers working with CCA have.. </p>  <p>If you tried to suppress a CRM popup and redirect it… you've probably seen this message a few times: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/5340.image_43579159.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-25-22-metablogapi/5340.image_5F00_43579159.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4263.image_thumb_2D8DA8FC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-25-22-metablogapi/4263.image_5F00_thumb_5F00_2D8DA8FC.png" width="390" height="162" /></a></p>  <p>So how do you get rid of it? </p>  <p>The 2 approaches I'm going to describe here work for CRM 3 and 4.0 and CRM 2011. </p>  <p>The most common and direct method is to modify the CRM server side javascript lib that generates the alert.    <br />However, I’m not going to name which JavaScript file it is or were it is as its highly unsupported to do so, and you should avoid doing that if you can.     <br /><strong>In short; Please do not do this</strong>.     <br />If you do choose to ignore this warning and go there, be aware that patches and updates to the CRM 2011 platform will most likely overwrite the file you changed and you will find that you need to make a manual update every time. </p>  <p>The way the CCA MCS team does this allows CRM to continue without server side changes and works for CRM UI elements hosted inside UII via a WebApplication adapter. </p>  <p>So how do we do it?    <br />We overwrite the in-memory copy of the JavaScript method that generates the popup alert, which is effectively doing the same thing as the server side change, however it only impacts CCA , this approach was developed by a peer of mine in MCS.</p>  <p><strong><em>This is updated from the prior post and I'm updating his new approach here with his permission. </em></strong></p>  <p>To do it, First you need a web application adapter, you can start one using the Visual Studio templates provided (CCA R1/CRM4 <a href="https://crmcca.codeplex.com/releases/view/44924" target="_blank">here</a>) (CCA R2/CRM2011 <a href="https://cid-5a34cce9728c8f4f.office.live.com/self.aspx/BlogShare/UII%20Starters%20and%20Templates%202001%20update3.vsi" target="_blank">here</a>) , or if you already have one, you can use it. </p>  <h5>Setting up the event hooks: </h5>  <p>In your web application adapter you need to override the Initialize method and add in a new event hook for Document complete, this event hook is a lower level event hook then what you would get with the Adapters version of Document complete and should only be used for this purpose. </p>  <p>Code: </p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">override</span> <span style="color: #0000ff">bool</span> Initialize()</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {    </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">bool</span> bRlst = <span style="color: #0000ff">base</span>.Initialize();    </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">this</span>.Browser.DocumentComplete += <span style="color: #0000ff">new</span> EventHandler&lt;Controls.DocumentCompleteEventArgs&gt;(Browser_DocumentComplete);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     <span style="color: #0000ff">return</span> bRlst;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> }</pre>
<!--CRLF--></div>
</div>

<p>This will set up our event direct connection to the IE Instance’s Document completed event, at a lower level then what CCA works with normally.</p>

<h5>Updating the function on the fly. </h5>

<p>Next we need to build out the event handler we created, which will be called when any part of the document raises a document complete event and overwrite the in memory version of the CRM handle popup blocker error function.</p>

<p>That event will look like this: </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">void</span> Browser_DocumentComplete(<span style="color: #0000ff">object</span> sender, Controls.DocumentCompleteEventArgs e)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     IWebBrowser2 browserFrame = e.pDisp <span style="color: #0000ff">as</span> IWebBrowser2;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">if</span> (browserFrame == <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         <span style="color: #0000ff">return</span>;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>         ((mshtml.HTMLDocumentClass)browserFrame.Document).parentWindow.execScript(<span style="color: #006080">&quot;handlePopupBlockerError=function(url) {}&quot;</span>, <span style="color: #006080">&quot;javascript&quot;</span>);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     <span style="color: #0000ff">catch</span>{}</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> }</pre>
<!--CRLF--></div>
</div>

<p>When this event is called it will run a JavaScript command that will overwrite the in memory handlePopupBlockerError function, have it do ‘nothing’ </p>

<p>The net result is that you will not get the popup blocker alert from CRM. </p>

<h5>Few cautionary notes: ( disclaimers ) </h5>

<p>Changing the behavior of CRM is an unsupported modification.. so if you encounter errors in CRM, make sure disable this event and validate that the error is still there prior to calling support on it.</p>

<p>Future updates may change the name of the method that we update here. While that is unlikely, this is an unsupported on the fly modification. The CRM team makes no guarantee the method name will not change. </p>

<p>This has been used and works successfully on CRM 3, 4 and 2011.</p>]]></content:encoded>
    </item>
    <item>
      <title>CRM Oct-2011 SDK update and new authentication method.</title>
      <link>https://docs.microsoft.com/archive/blogs/mbarbour/crm-oct-2011-sdk-update-and-new-authentication-method</link>
      <pubDate>Mon, 19 Dec 2011 12:37:37 GMT</pubDate>
      <dc:creator><![CDATA[MattB-MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mbarbour/2011/12/19/crm-oct-2011-sdk-update-and-new-authentication-method/</guid>
      <description><![CDATA[With the roll out of the CRM 2011 on Office 365,&#160; a new authentication process was added to...]]></description>
      <content:encoded><![CDATA[<p>With the roll out of the <a href="https://community.dynamics.com/product/crm/crmtechnical/b/crmukblog/archive/2011/12/13/crm-online-now-live-on-osdp.aspx" target="_blank">CRM 2011 on Office 365</a>,&#160; a new authentication process was added to support it and allow for delegated authentication for CRM online.&#160; This authentication method also works for CRM Online (Live) and all forms of Premise base authentication. </p>  <h4>Lets talk about History for just min. </h4>  <p>There are several ways to do authentication from client applications that have existed since RTM,&#160; as a general rule, they are either done using the simple constructor on the proxy, or the IServiceConfiguration interface.&#160;&#160; </p>  <p>What I call simple constructor approach provides two constructors,&#160; one for the Discovery Service Proxy, and one for the Organization Service Proxy    <br />For the <a href="https://technet.microsoft.com/en-us/library/microsoft.xrm.sdk.client.discoveryserviceproxy_members.aspx" target="_blank">Discovery Service Proxy</a>, the <a href="https://technet.microsoft.com/en-us/library/gg325065.aspx" target="_blank">simple constructor</a> requires you to know a lot about the server connection up front, the same is true for the <a href="https://technet.microsoft.com/en-us/library/gg325179.aspx" target="_blank">simple constructor</a> for the <a href="https://technet.microsoft.com/en-us/library/microsoft.xrm.sdk.client.organizationserviceproxy_members.aspx" target="_blank">Organization Service Proxy</a>&#160;</p>  <p>You need to know what the URL of the service you want to connect too is,&#160; you need to know the user and device credentials, the home realm URI, and the right parameters to use with the right settings for the type of auth you want. </p>  <p>Seems simple,&#160; what's going on there behind the scenes though is pretty complicated and fairly time consuming.&#160; In short, for each type of of Service Proxy,&#160; the SDK is calling the WCF MEX service on CRM to get the WSDL to build the proxy for the type of server connection,&#160; then wiring up that proxy and returning it to the caller.&#160;&#160; Notice I didn’t say “Authenticate” there…&#160; Authentication happens the first time to you try to do something with the newly created service proxy. </p>  <p>From a time perspective,&#160; that’s a pretty heavy operation.&#160; One of the worst things that can happen here its to create, use, destroy , recreate , etc...    <br />For performance, you really need to hold on to the constructed proxy and use it for the life of your connect.&#160;&#160; The other challenge here is that you don’t have visibility to what is taking up time in this operation… is it the WSDL create? or the Auth? or the proxy Generation ? or perhaps the call to CRM itself. </p>  <p>In the RTM Release,&#160; we were also provided the <a href="https://technet.microsoft.com/en-us/library/gg308385.aspx" target="_blank">IServiceConfiguration</a> interface.. which provided us with a more component based capability to set up the Proxy, Authenticate, and create the Discovery Service or Organization Service proxy.&#160; Using the IServiceConfiguration Method, via the ServiceConfigurationFactory.CreateConfiguration method, we can setup the Proxy, then manage authentication,&#160; then create the proxy we wish with the preconfigured <a href="https://technet.microsoft.com/en-us/library/gg308385.aspx" target="_blank">IServiceConfiguration</a> interface. </p>  <p>Now, the sticky part in the <a href="https://technet.microsoft.com/en-us/library/gg308385.aspx" target="_blank">IServiceConfiguration</a> interface is authentication.&#160; there are several different ways to do it, based on the authentication type you need and the CRM Server type you are connected too. </p>  <p>There are several examples in the CRM SDK that cover this process. </p>  <h4>Microsoft.Xrm.Sdk.Client.<a href="https://technet.microsoft.com/en-us/library/hh547372.aspx" target="_blank">IServiceManagement</a> </h4>  <p>The new <a href="https://technet.microsoft.com/en-us/library/hh547372.aspx" target="_blank">IServiceManagment</a> interface provides a us the same ability of the <a href="https://technet.microsoft.com/en-us/library/gg308385.aspx" target="_blank">IServiceConfiguration</a>method, with a much more straight forward and easy to use authentication process,&#160; Additionally it fully supports OSDP ( that’s CRM on Office 365 ) via the authentication process, without having to do anything “special”, and allows for a fairly easy centralization of proxy generation for the CRM connection. </p>  <p>This authentication data is wrapped up nicely in a new class called <a href="https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.client.authenticationcredentials.aspx" target="_blank">AuthenticationCredentials</a> and a method on the <a href="https://technet.microsoft.com/en-us/library/hh547372.aspx" target="_blank">IServiceManagement</a> interface called Authenticate. </p>  <p>With the release of the service management interface,&#160; I moved much of my code over to use it in order to streamline the CRM connect process in my environment,&#160; however in testing I was challenged with Delegated Claims authentication. </p>  <h6>Using Delegated Claims Auth and the IServiceManagement interface. </h6>  <p><em>In an attempt to be clear:      <br />I had an on premise CRM instance that was configured for claims… lets call it crm.contso.com.&#160; It is also configured to accept authentication for users in the Fabrikam.com domain.</em>&#160; </p>  <p>Now,&#160; in the IServiceConfiguration interface, I would need to write code to deal with this using the cross domain auth process, using the HomeRealm URI to access the correct auth store.&#160;&#160; The code that supports that , of course, was unique and different then using the code to hit windows live, IFD or AD. </p>  <p>Using the IServiceManagement interface, I set up my code to look a like this: </p>  <p>Where userCredentials is <a href="mailto:myuser@fabrikam.com">myuser@fabrikam.com</a> + the password,&#160; and homeRealm pointed at the ADFS Auth service for Fabrikam.com </p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; height: 332px; max-height: 400px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> AuthenticationCredentials authCred = <span style="color: #0000ff">new</span> AuthenticationCredentials();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> authCred.ClientCredentials = userCredentials;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #0000ff">if</span> (servicecfg.AuthenticationType == AuthenticationProviderType.LiveId )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     authCred.SupportingCredentials = <span style="color: #0000ff">new</span> AuthenticationCredentials() { ClientCredentials = deviceCredentials };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> <span style="color: #008000">// Claims </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">if</span> (homeRealm != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     authCred.HomeRealm = homeRealm;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> <span style="color: #008000">// Deal with an incorrect configuration here. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> <span style="color: #008000">// Home Realm should not be used if the Service Identifier and the homeRealm are the same thing. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span> <span style="color: #0000ff">if</span> (homeRealm != <span style="color: #0000ff">null</span> &amp;&amp; homeRealm.ToString() != servicecfg.PolicyConfiguration.SecureTokenServiceIdentifier)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     authCred.AppliesTo = <span style="color: #0000ff">new</span> Uri(servicecfg.PolicyConfiguration.SecureTokenServiceIdentifier);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span> <span style="color: #008000">// Run Authentication </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span> <span style="color: #008000">// Failure will generate Exceptions </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span> authCred = servicecfg.Authenticate(authCred);</pre>
<!--CRLF--></div>
</div>

<p>As the Homerealm is provided , I set the AppliesTo property of the AuthenticationCredentials class to it.&#160; That will tell the authentication method to authenticate against Fabrikam’s ADFS system. </p>

<p>Next I get the Security Token and pass it to the Proxy Constructor that I want.. in this case the discovery server: </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; height: 64px; max-height: 400px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> SecurityTokenResponse AuthKey = authCred.SecurityTokenResponse;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> DiscoveryServiceProxy proxy  = <span style="color: #0000ff">new</span> DiscoveryServiceProxy((IServiceManagement&lt;IDiscoveryService&gt;)servicecfg, AuthKey);</pre>
<!--CRLF--></div>
</div>

<p>This call generates a a MessageSecurityException exception.&#160; But why ? </p>

<p>Well,&#160; going back over the SDK docs and other sample code… I was unable to come with an answer,&#160; I had even tried to use the sample code provided in the SDK to do this.&#160;&#160; Still no luck. </p>

<p>Reach out internally I found out that there is one extra step that needs to be done to make delegated claims auth work. </p>

<p>In sum,&#160; what needed to be done was to check the IServiceManagement PolicyConfiguration.SecureTokenServiceIdentifier against homeRealm, if they were different, I needed to execute a second auth on the IServiceManagement endpoint using SecurityTokenResponse of the auth against Fabrikam. </p>

<p>once I had done that… it worked.. so it ended up looking like this: </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; height: 750px; max-height: 750px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> AuthenticationCredentials authCred = <span style="color: #0000ff">new</span> AuthenticationCredentials();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> authCred.ClientCredentials = userCredentials;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #0000ff">if</span> (servicecfg.AuthenticationType == AuthenticationProviderType.LiveId )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     authCred.SupportingCredentials = <span style="color: #0000ff">new</span> AuthenticationCredentials() { ClientCredentials = deviceCredentials };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> <span style="color: #008000">// Claims </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">if</span> (homeRealm != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     authCred.HomeRealm = homeRealm;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> <span style="color: #008000">// Deal with an incorrect configuration here. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> <span style="color: #008000">// Home Realm should not be used if the Service Identifier and the homeRealm are the same thing. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span> <span style="color: #0000ff">if</span> (homeRealm != <span style="color: #0000ff">null</span> &amp;&amp; homeRealm.ToString() != servicecfg.PolicyConfiguration.SecureTokenServiceIdentifier)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     authCred.AppliesTo = <span style="color: #0000ff">new</span> Uri(servicecfg.PolicyConfiguration.SecureTokenServiceIdentifier);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span> <span style="color: #008000">// Run Authentication </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span> <span style="color: #008000">// Failure will generate Exceptions </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span> authCred = servicecfg.Authenticate(authCred);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #008000">// If is Federation and HomeRealm is not null, and HomeRealm is Not the same as the SecureTokeServiceIdentifier </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span> <span style="color: #008000">// Run Seconday auth to auth the Token to the right source. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span> SecurityTokenResponse AuthKey = <span style="color: #0000ff">null</span>;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span> <span style="color: #0000ff">if</span> (servicecfg.AuthenticationType == AuthenticationProviderType.Federation &amp;&amp;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span>         homeRealm != <span style="color: #0000ff">null</span> &amp;&amp;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span>         !<span style="color: #0000ff">string</span>.IsNullOrWhiteSpace(homeRealm.ToString()) &amp;&amp;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span>         (homeRealm.ToString() != servicecfg.PolicyConfiguration.SecureTokenServiceIdentifier))</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span>     <span style="color: #008000">// Relaying Auth to Resource Server</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span>     dtAuthQuery = DateTime.UtcNow;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span>     <span style="color: #008000">// Auth token against the correct server. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>     AuthenticationCredentials authCred2 = servicecfg.Authenticate(<span style="color: #0000ff">new</span> AuthenticationCredentials()</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span>         SecurityTokenResponse = authCred.SecurityTokenResponse</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>     });</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span>     logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - Authenticated via {1}. Auth Elapsed:{2}&quot;</span>, LogString, servicecfg.AuthenticationType, dtAuthQuery.Subtract(DateTime.UtcNow).Duration().ToString()), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span>     AuthKey = authCred2.SecurityTokenResponse;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39">  39:</span> <span style="color: #0000ff">else</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum40">  40:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum41">  41:</span>     logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - Authenticated via {1}. Auth Elapsed:{2}&quot;</span>, LogString, servicecfg.AuthenticationType, dtAuthQuery.Subtract(DateTime.UtcNow).Duration().ToString()), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum42">  42:</span>     AuthKey = authCred.SecurityTokenResponse;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum43">  43:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum44">  44:</span> DiscoveryServiceProxy proxy = <span style="color: #0000ff">new</span> DiscoveryServiceProxy((IServiceManagement&lt;IDiscoveryService&gt;)servicecfg, AuthKey);</pre>
<!--CRLF--></div>
</div>

<p>That allowed me to auth across claims realms, create the proxy I was interested. </p>

<h3>Helper method to build the Discovery Service and Organization Service Proxies Supporting all current forms of CRM 2011 auth.&#160; </h3>

<p>I have wrapped up the code I used to do this into a helper method supporting both the Organization and Discovery server proxy's is here,&#160; it will also appear in the update to the UII Solution Starters Agent desktop starter code once I release the update to that. ( soon )&#160;&#160; .. as with all code .. use at your own risk.. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// &lt;summary&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// Creates and authenticates the Service Proxy for either the discovery server or organization service for CRM</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// &lt;/summary&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// &lt;typeparam name=&quot;T&quot;&gt;Service Management Type&lt;/typeparam&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// &lt;param name=&quot;servicecfg&quot;&gt;Pre-created Service Configuration object&lt;/param&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// &lt;param name=&quot;ServiceUri&quot;&gt;URL to connect too&lt;/param&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// &lt;param name=&quot;homeRealm&quot;&gt;HomeRealm URI&lt;/param&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// &lt;param name=&quot;userCredentials&quot;&gt;User Credentials object&lt;/param&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// &lt;param name=&quot;deviceCredentials&quot;&gt;Device Credentials object&lt;/param&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// &lt;param name=&quot;LogString&quot;&gt;Log Preface string. &lt;/param&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/// &lt;returns&gt;&lt;/returns&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">object</span> CreateAndAuthenticateProxy&lt;T&gt;(IServiceManagement&lt;T&gt; servicecfg,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    Uri ServiceUri,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    Uri homeRealm,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    ClientCredentials userCredentials,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    ClientCredentials deviceCredentials,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">string</span> LogString)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    LoginTracer logEntry = <span style="color: #0000ff">new</span> LoginTracer();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    DateTime dtConnectTimeCheck = DateTime.UtcNow;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">object</span> OutObject = <span style="color: #0000ff">null</span>;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (servicecfg == <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - attempting to connect to CRM server @ {1}&quot;</span>, LogString, ServiceUri.ToString()), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// Create the Service configuration for that URL</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        servicecfg = ServiceConfigurationFactory.CreateManagement&lt;T&gt;(ServiceUri);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (servicecfg == <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> <span style="color: #0000ff">null</span>;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - created CRM server proxy configuration for {1} - duration: {2}&quot;</span>, LogString, ServiceUri.ToString(), dtConnectTimeCheck.Subtract(DateTime.UtcNow).Duration().ToString()), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">else</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - will use user provided {1} to connect to CRM &quot;</span>, LogString, <span style="color: #0000ff">typeof</span>(T).ToString()), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #008000">// Auth</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - proxy requiring authentication type : {1} &quot;</span>, LogString, servicecfg.AuthenticationType), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #008000">// Determine the type of authentication required. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (servicecfg.AuthenticationType != AuthenticationProviderType.ActiveDirectory)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// Connect via anything other then AD. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// Setup for Auth Check Perf. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        DateTime dtAuthQuery = DateTime.UtcNow;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        AuthenticationCredentials authCred = <span style="color: #0000ff">new</span> AuthenticationCredentials();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        authCred.ClientCredentials = userCredentials;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (servicecfg.AuthenticationType == AuthenticationProviderType.LiveId)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            authCred.SupportingCredentials = <span style="color: #0000ff">new</span> AuthenticationCredentials() { ClientCredentials = deviceCredentials };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// Claims </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (homeRealm != <span style="color: #0000ff">null</span>)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            authCred.HomeRealm = homeRealm;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// Deal with an incorrect configuration here. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// Home Realm should not be used if the Service Identifier and the homeRealm are identical. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (homeRealm != <span style="color: #0000ff">null</span> &amp;&amp; homeRealm.ToString() != servicecfg.PolicyConfiguration.SecureTokenServiceIdentifier)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            authCred.AppliesTo = <span style="color: #0000ff">new</span> Uri(servicecfg.PolicyConfiguration.SecureTokenServiceIdentifier);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// Run Authentication </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// Failure will generate an exception. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        authCred = servicecfg.Authenticate(authCred);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// If is Federation and HomeRealm is not null, and HomeRealm is Not the same as the SecureTokeServiceIdentifier </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// Run Seconday auth to auth the Token to the right source. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        SecurityTokenResponse AuthKey = <span style="color: #0000ff">null</span>;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (servicecfg.AuthenticationType == AuthenticationProviderType.Federation &amp;&amp;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                homeRealm != <span style="color: #0000ff">null</span> &amp;&amp;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                !<span style="color: #0000ff">string</span>.IsNullOrWhiteSpace(homeRealm.ToString()) &amp;&amp;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                (homeRealm.ToString() != servicecfg.PolicyConfiguration.SecureTokenServiceIdentifier))</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - Initial Authenticated via {1} {3} . Auth Elapsed:{2}&quot;</span>, LogString, servicecfg.AuthenticationType, dtAuthQuery.Subtract(DateTime.UtcNow).Duration().ToString(), homeRealm.ToString()), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - Relaying Auth to Resource Server: From {1} to {2}&quot;</span>, LogString, homeRealm.ToString(), servicecfg.PolicyConfiguration.SecureTokenServiceIdentifier), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            dtAuthQuery = DateTime.UtcNow;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">// Auth token against the correct server. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            AuthenticationCredentials authCred2 = servicecfg.Authenticate(<span style="color: #0000ff">new</span> AuthenticationCredentials()</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                SecurityTokenResponse = authCred.SecurityTokenResponse</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            });</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - Authenticated via {1}. Auth Elapsed:{2}&quot;</span>, LogString, servicecfg.AuthenticationType, dtAuthQuery.Subtract(DateTime.UtcNow).Duration().ToString()), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            AuthKey = authCred2.SecurityTokenResponse;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">else</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - Authenticated via {1}. Auth Elapsed:{2}&quot;</span>, LogString, servicecfg.AuthenticationType, dtAuthQuery.Subtract(DateTime.UtcNow).Duration().ToString()), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            AuthKey = authCred.SecurityTokenResponse;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (<span style="color: #0000ff">typeof</span>(T) == <span style="color: #0000ff">typeof</span>(IDiscoveryService))</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            OutObject = <span style="color: #0000ff">new</span> DiscoveryServiceProxy((IServiceManagement&lt;IDiscoveryService&gt;)servicecfg, AuthKey);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (<span style="color: #0000ff">typeof</span>(T) == <span style="color: #0000ff">typeof</span>(IOrganizationService))</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            OutObject = <span style="color: #0000ff">new</span> OrganizationServiceProxy((IServiceManagement&lt;IOrganizationService&gt;)servicecfg, AuthKey);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">else</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">// Create the proxy here... we except out here if Auth Fails. </span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (<span style="color: #0000ff">typeof</span>(T) == <span style="color: #0000ff">typeof</span>(IDiscoveryService))</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            OutObject = <span style="color: #0000ff">new</span> DiscoveryServiceProxy((IServiceManagement&lt;IDiscoveryService&gt;)servicecfg, userCredentials);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (<span style="color: #0000ff">typeof</span>(T) == <span style="color: #0000ff">typeof</span>(IOrganizationService))</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            OutObject = <span style="color: #0000ff">new</span> OrganizationServiceProxy((IServiceManagement&lt;IOrganizationService&gt;)servicecfg, userCredentials);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    logEntry.Log(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0} - service proxy created - total create duration: {1}&quot;</span>, LogString, dtConnectTimeCheck.Subtract(DateTime.UtcNow).Duration().ToString()), TraceEventType.Verbose);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> OutObject;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<!--CRLF--></div>
</div>

<p>To use it to create a connection to a discovery server : </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">object</span> objectRlst = CreateAndAuthenticateProxy&lt;IDiscoveryService&gt;(<span style="color: #0000ff">null</span>, discoveryServiceUri, homeRealmUri, clientCredentials, deviceCredentials, <span style="color: #006080">&quot;DiscoverOrganizations&quot;</span>);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #0000ff">if</span> (objectRlst != <span style="color: #0000ff">null</span> &amp;&amp; objectRlst <span style="color: #0000ff">is</span> DiscoveryServiceProxy)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     discoveryServiceProxy = (DiscoveryServiceProxy)objectRlst; </pre>
<!--CRLF--></div>
</div>

<p>To use it to create a connection to Live’s Organization service,&#160; You call it as such: </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">object</span> oProx = <span style="color: #0000ff">null</span>;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> oProx = CreateAndAuthenticateProxy&lt;IOrganizationService&gt;(<span style="color: #0000ff">null</span>, oOrgSvc, <span style="color: #0000ff">null</span>, userClientCred, DeviceCredentials, <span style="color: #006080">&quot;ConnectAndInitCrmOrgService&quot;</span>);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">if</span> (oProx != <span style="color: #0000ff">null</span> &amp;&amp; oProx <span style="color: #0000ff">is</span> OrganizationServiceProxy)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     prox = (OrganizationServiceProxy)oProx;</pre>
<!--CRLF--></div>
</div>

<p>Hope this helps someone else along the way. </p>]]></content:encoded>
    </item>
    <item>
      <title>Installing the Customer Care Accelerator ( CCA ) for CRM 2011</title>
      <link>https://docs.microsoft.com/archive/blogs/mbarbour/installing-the-customer-care-accelerator-cca-for-crm-2011</link>
      <pubDate>Fri, 04 Nov 2011 08:38:19 GMT</pubDate>
      <dc:creator><![CDATA[MattB-MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mbarbour/2011/11/04/installing-the-customer-care-accelerator-cca-for-crm-2011/</guid>
      <description><![CDATA[One of the things that Iv needed to do for a while is write up a detailed step by step of how to get...]]></description>
      <content:encoded><![CDATA[<p>One of the things that Iv needed to do for a while is write up a detailed step by step of how to get CCA built and working for folks outside MS,&#160; as fate would have it, one thing after another kept coming up and I finally got around to starting to work on it this week.&#160; Considering it had been months since I first decided to do this, I thought to check around on the net to see if someone else had done it already…&#160; No sense in repeating work <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/0474.wlEmoticon-smile_100244AB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/0474.wlEmoticon_2D00_smile_5F00_100244AB.png" /></p>  <p>I found<strong> </strong><a href="https://gtcrm.wordpress.com/2011/07/14/installing-the-customer-care-accelerator-cca-for-crm-2011/" target="_blank"><strong>this post</strong></a> by Gareth Tucker that covers the kinks in the initial setup process for CCA.&#160; <br /><strong>Thanks Gareth for getting this posted</strong>! </p>  <h3>Running the CCA RI tool on Non English Systems. </h3>  <p>There is one additional point when installing CCA to Non English System.&#160;&#160; The RI tool has a hard coded process that is looking for the role name “CSR Manager”, as you might imagine,&#160; that name does not exist on a non-English CRM system. </p>  <p>So to fix that,&#160;&#160; You will find that hardcoded value in the RIConfigLoader project, in the ConfigureCcaHostedApps.cs file.. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/7737.image_5A898285.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/7737.image_5F00_5A898285.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/1563.image_thumb_2ED8B889.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/1563.image_5F00_thumb_5F00_2ED8B889.png" width="362" height="186" /></a></p>  <p>Open that file up and press Ctrl-G on your keyboard,&#160; and goto line number 388</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/7750.image_46FC22E4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/7750.image_5F00_46FC22E4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/3630.image_thumb_71685401.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/3630.image_5F00_thumb_5F00_71685401.png" width="244" height="109" /></a></p>  <p>here you will find the offending code…</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// Assigning the Role with a name [CSR Manager] to the team with specific Guid.</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     RIScenarioCreator.AssignRoleToTeam(orgService, EscalationTeamId, <span style="color: #006080">&quot;CSR Manager&quot;</span>);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (ApplicationException ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     <span style="color: #0000ff">throw</span> (<span style="color: #0000ff">new</span> ApplicationException(Properties.Resources.ErrorCreatingEscalitionTeam, ex));</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>As you can see the “CSR Manager” string..&#160;&#160; Change this to the CSR Manager role name in your system’s language and you should be good to go. </p>

<p>Compile and Run it. </p>

<h3>Running the CCA RI Tool more then once on the same system. </h3>

<p>So, if you are here, looking at the error above,&#160; you have probably run into the error:
  <br />---------------------------

  <br />Error

  <br />---------------------------

  <br />There was an error while creating Escalation Team.

  <br />Unable to assign the Specified Role

  <br />---------------------------</p>

<p>Simply put, the RI tool doesn't like to be run more the once on the same system.. this is due to the the fact its not compensating for a partial install. </p>

<p>Fixing it is pretty simple,&#160; You need to remove the Escalation Team from CRM, </p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/7245.image_10AAFAD5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/7245.image_5F00_10AAFAD5.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/25/22/metablogapi/4213.image_thumb_05153D96.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-25-22-metablogapi/4213.image_5F00_thumb_5F00_05153D96.png" width="459" height="34" /></a></p>

<p>Delete that and the RI should run again. </p>

<p>MattB. </p>]]></content:encoded>
    </item>
  </channel>
</rss>