<?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>Dan Budimir's boodablog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/boodablog/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/boodablog/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:20:33 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>I thought I needed a SharePoint Provider Hosted App for that. - Part 2</title>
      <link>https://docs.microsoft.com/archive/blogs/boodablog/i-thought-i-needed-a-sharepoint-provider-hosted-app-for-that-part-2</link>
      <pubDate>Tue, 13 Jan 2015 12:57:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Budimir]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/boodablog/2015/01/13/i-thought-i-needed-a-sharepoint-provider-hosted-app-for-that-part-2/</guid>
      <description><![CDATA[In my previous post I explained how to create a SharePoint Remote Event Receiver (RER) without the...]]></description>
      <content:encoded><![CDATA[<p><font face="Segoe UI"><span style="font-size: small"><span style="font-family: calibri"><span style="color: rgb(0,0,0)"><font face="Segoe UI">In my previous post I explained how to create a SharePoint Remote Event Receiver (RER) without the need for a Provider Hosted Application (PHA).&#160; In this post I’ll go over a few limitations to this approach that may help you determine if it is right for you.&#160; I’ll also talk a bit about some other </font></span></span></span><span style="font-size: small"><span style="font-family: calibri"><span style="color: rgb(0,0,0)"><font face="Segoe UI">some other really great client side enhancements that you may or may not have know did not require a PHA</font>.</span></span></span></font></p>  <h1><span style="font-size: small"><span style="font-family: calibri"><span style="color: rgb(0,0,0)"><font face="Segoe UI"></font></span></span></span></h1>  <h1><span style="font-size: small"><span style="font-family: calibri"><span style="color: rgb(0,0,0)"><font face="Segoe UI"></font></span></span></span></h1>  <h1><font face="Segoe UI">Limitations</font></h1>  <p><font size="2">Lets assume that based on some of the data that is being changed you’d like to call back to SharePoint to get some other data in another list to do some processing.&#160; Or, lets assume you have added say… 20 columns to your list and you are comparing some of them to each other, if the user decided to use the Quick Edit in SharePoint you’d only receive the columns that were actually changed in AfterProperties, so now you’re a bit stuck because if you need to compare the changed data against other data in the list item that was not changed, you’d have to find some way to call back to SharePoint.</font></p>  <p><font size="2">The call back to SharePoint would typically be done through a trusted connection in the context of the SharePoint user or an app… and for that you do indeed need an app.&#160; Consider the following code that executes in a RER.     <br />      <br /><font color="#2b91af"><font color="#2b91af"><font color="#2b91af">ClientContext</font></font></font><font color="#000000"> clientContext = </font><font color="#2b91af"><font color="#2b91af"><font color="#2b91af">TokenHelper</font></font></font></font><font color="#000000" size="2">.CreateRemoteEventReceiverClientContext(properties);     <br />      <br />clientContext, without an app in place will always return as null.</font></p>  <p><font size="2"><font color="#000000">I’ll digress a&#160;&#160; bit. This is the context that would typically be used to talk back to SharePoint.&#160; </font><font color="#000000">If on prem and using high trust with a PHA, the code in the TokenHelper class grabs the path to your pfx file and the pfx password from your web.config, creates a windows identity X509 signing cred using claims passed from SharePoint, then calls back to SharePoint using the cred on behalf of the SharePoint user.&#160;&#160; Whew!, and that’s paraphrased, there’s plenty of documentation out there about how this works.&#160; If o365, an ACS access token is used to create the trusted connection, once again, beyond the scope of this post.&#160; The bottom line is that if we don’t have an app then calling back to SharePoint would require creating a cred using through some other means like storing a user name and password, a service account, etc. etc..</font></font></p>  <h1><font face="Segoe UI">Some other pretty cool things you can do without a PHA.</font></h1>  <p><font size="2"><strong>JavaScript Injection</strong> – this pattern is a great way for you to make changes to master pages, page layouts, any page that renders in your Site Collection for that matter, without the need for uploading custom versions.&#160; You only need to run a bit of server side CSOM through a console app, windows forms app, web application, etc.&#160; A custom action is added that tells SharePoint to add your js file as a script link, all you need is a web site to put your file.&#160; That’s it, once added the js file will load each time a SharePoint page loads and “Inject” your mods dynamically.&#160; No PHA required.&#160; Check it out in </font><a href="https://github.com/OfficeDev/PnP/tree/master/Samples/Core.JavaScriptInjection"><font size="2">GitHub</font></a><font size="2">.&#160; There’s also a sample on how to use this pattern through JSOM </font><a href="https://github.com/OfficeDev/PnP/tree/master/Samples/Core.JavaScriptInjectionJSOM"><font size="2">here</font></a><font size="2">.</font></p>  <p><font size="2">I was going to add more but really there are too many to list.&#160; Check out all of the OfficePNP samples in GitHub </font><a href="https://github.com/OfficeDev/PnP/tree/master/Samples"><font size="2">here</font></a><font size="2">, you’ll notice that there are a plethora of things you can do to customize your SharePoint site that you may have been thought required a PHA.</font></p>  <p>&#160;</p>  <p>&#160;</p>  <p>&#160;</p>  <p><font color="#000000" size="2"></font><font size="2" face="Consolas"><font size="2" face="Consolas"></font></font></p>]]></content:encoded>
    </item>
    <item>
      <title>I thought I needed a SharePoint Provider Hosted App for that. - Part 1</title>
      <link>https://docs.microsoft.com/archive/blogs/boodablog/i-thought-i-needed-a-sharepoint-provider-hosted-app-for-that-part-1</link>
      <pubDate>Mon, 12 Jan 2015 16:35:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Budimir]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/boodablog/2015/01/12/i-thought-i-needed-a-sharepoint-provider-hosted-app-for-that-part-1/</guid>
      <description><![CDATA[This is part 1 of 2 where I&rsquo;ll explain deploying a SharePoint Remote Event Receiver...]]></description>
      <content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0in 0in 8pt;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="color: #000000;">This is part 1 of 2 where I&rsquo;ll explain deploying a SharePoint Remote Event Receiver (RER)&nbsp;without the need for a Provider Hosted Application (PHA).<span style="mso-spacerun: yes;">&nbsp; </span>In part 2 I&rsquo;ll talk a bit about the limitations of this approach and also mention some other really great client side enhancements that you can add without deploying a PHA.&nbsp; A code sample in <a href="https://github.com/danbudimir/RERWithoutPHA">GitHub</a> is also available.<br /><br /></span></span></span><span style="font-size: small;"><span style="font-family: Calibri;"><span style="color: #000000;">I&rsquo;ve done a bunch of work with RER's and talk about them regularly.<span style="mso-spacerun: yes;">&nbsp; </span>Recently, I was mentioning to a colleague that a&nbsp;RER would be clutch to take care of some advanced data updating and validation when adding or changing list items in lists and document libraries.<span style="mso-spacerun: yes;">&nbsp; </span>He said it sounded cool, but was not excited about the prospect of deploying a complete PHA&nbsp;just to do some validation in the host web.<span style="mso-spacerun: yes;">&nbsp; </span>I told him that he didn&rsquo;t have to deploy a PHA to use an RER.<span style="mso-spacerun: yes;">&nbsp; </span>He looked at me quizzically and said, &ldquo;I thought I needed an app for that&rdquo;.<span style="mso-spacerun: yes;">&nbsp; </span>A call to an RER is simply SharePoint making a connection to a REST endpoint, passing in some arguments and retrieving a response, it does not require the high trust connection typically associated with PHA&rsquo;s.<span style="mso-spacerun: yes;">&nbsp; </span>The following steps will explain deployment of an RER without the need for a provider hosted app.</span></span></span><span style="color: #000000; font-family: Calibri; font-size: small;">&nbsp;</span></p>
<p class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;"><span style="color: #000000;"><span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: ignore;"><span style="font-family: Calibri; font-size: small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Create or use an existing SharePoint site, add a list, add some columns to the list, etc., etc.<span style="mso-spacerun: yes;">&nbsp; </span>We need a list in a SharePoint site for this example, use whatever one you want. </span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;"><span style="color: #000000;"><span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: ignore;"><span style="font-family: Calibri; font-size: small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">In Visual Studio, create an &ldquo;ASP.Net Empty Web Application&rdquo; called RERWithoutPHA. </span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;"><span style="color: #000000;"><span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: ignore;"><span style="font-family: Calibri; font-size: small;">3.</span><span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Right click on the RERWithoutPHA project, then choose Manage &ldquo;NuGet Packages&hellip;&rdquo;.<span style="mso-spacerun: yes;">&nbsp; </span>In the search box enter &ldquo;pnp&rdquo;.<span style="mso-spacerun: yes;">&nbsp; </span>Choose on-prem or cloud and install.<br /><span style="mso-no-proof: yes;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/03/metablogapi/6253.clip_image002_5218E9AC.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-03-metablogapi/6253.clip_5F00_image002_5F00_5218E9AC.jpg"><img style="border: 0px currentColor; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="clip_image002" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/03/metablogapi/1781.clip_image002_thumb_3F63EFF5.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-03-metablogapi/1781.clip_5F00_image002_5F00_thumb_5F00_3F63EFF5.jpg" alt="clip_image002" width="777" height="207" border="0" /></a></span> <br />(The PNP NuGet package is awesome, it scaffolds your project with all you&rsquo;ll need to access SharePoint from your remote web server (or any application for that matter) and includes the Tokenhelper and SharePointContext classes, so if you were creating a PHA this is all you&rsquo;d need to do to get rolling.<span style="mso-spacerun: yes;">&nbsp; </span>But&hellip; in all truth, for this example all we need is a reference to Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll) </span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; text-indent: -0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1; mso-layout-grid-align: none;"><span style="font-size: small;"><span style="background: white; color: black; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-highlight: white;"><span style="mso-list: ignore;"><span style="font-family: Calibri;">4.</span><span style="line-height: normal; font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="color: #000000;"><span style="font-family: Calibri;">Add a &ldquo;WCF Service&rdquo; to the RERWithoutPHA called RERSynchronous.&nbsp; <span style="line-height: 107%; font-family: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;">Edit the RERSynchronous service code behind then implement &ldquo;</span><span style="background: white; color: #2b91af; line-height: 107%; font-family: 'Calibri','sans-serif'; mso-bidi-font-family: consolas; mso-highlight: white; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;">IRemoteEventService</span><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;">&rdquo;.</span></span></span><span style="color: #000000;"><span style="font-family: Calibri;"> <br /></span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">using</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> Microsoft.SharePoint.Client.EventReceivers; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">namespace</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> RERWithoutPHA </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="background: white; color: black; font-family: consolas; font-size: xx-small; mso-highlight: white;"><span>{ </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;</span><span style="mso-spacerun: yes;">&nbsp;&nbsp; </span></span><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">public </span><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">class </span><span style="background: white; color: #2b91af; font-family: consolas; mso-highlight: white;">RERSynchronous</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> : </span><span style="background: white; color: #2b91af; font-family: consolas; mso-highlight: white;">IRemoteEventService</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>{ <br /></span><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public </span><span style="background: white; color: #2b91af; font-family: consolas; mso-highlight: white;">SPRemoteEventResult</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> ProcessEvent(</span><span style="background: white; color: #2b91af; font-family: consolas; mso-highlight: white;">SPRemoteEventProperties</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> properties) </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{ <br /></span><span style="background: white; color: #2b91af; font-family: consolas; mso-highlight: white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SPRemoteEventResult</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> result = </span><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">new&nbsp;</span><span style="background: white; color: #2b91af; font-family: consolas; mso-highlight: white;">SPRemoteEventResult</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;">(); </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">// if this is a document library and this item is being updated, have a look at the </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //value of the fields before they were changed.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">// the BeforeProperties collection is only available for document libraries, it will be null for&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // lists</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes;">&nbsp;</span></span><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> myFieldBefore = properties.ItemEventProperties.BeforeProperties[</span><span style="background: white; color: #a31515; font-family: consolas; mso-highlight: white;">"myField"</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;">].ToString(); </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">// Have a look at the changed fields.<span style="mso-spacerun: yes;">&nbsp; </span>Of Course you'll have to change "myField" to the name of a <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // field in your list or document library</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> myFieldAfter = properties.ItemEventProperties.AfterProperties[</span><span style="background: white; color: #a31515; font-family: consolas; mso-highlight: white;">"myField"</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;">].ToString(); </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">// Maybe you'd like to change the value of a field in your list item</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>result.ChangedItemProperties.Add(</span><span style="background: white; color: #a31515; font-family: consolas; mso-highlight: white;">"fieldIWantToChange"</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;">, </span><span style="background: white; color: #a31515; font-family: consolas; mso-highlight: white;">"My New value"</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;">); </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">//<span style="mso-spacerun: yes;">&nbsp; </span>maybe you don't like what's been done and want to tell SharePoint to cancel the save</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">// comment in the lines below to see the save cancel</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">//result.ErrorMessage = "No can do!";</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">//result.Status = SPRemoteEventServiceStatus.CancelWithError;<br /></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: xx-small;"><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">//YOU GET THE PICTURE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: xx-small;"><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">return</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> result; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="background: white; color: black; font-family: consolas; font-size: xx-small; mso-highlight: white;"><span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-size: xx-small;"><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">public </span><span style="background: white; color: blue; font-family: consolas; mso-highlight: white;">void</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> ProcessOneWayEvent(</span><span style="background: white; color: #2b91af; font-family: consolas; mso-highlight: white;">SPRemoteEventProperties</span><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"> properties) </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="background: white; color: black; font-family: consolas; font-size: xx-small; mso-highlight: white;"><span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{ </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">//this event will not fire unless Asynchronous methods have been registered</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="font-size: xx-small;"><span style="background: white; color: black; font-family: consolas; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="background: white; color: green; font-family: consolas; mso-highlight: white;">//but must be here to satisfy the IRemoteEventService interface</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="background: white; color: black; font-family: consolas; font-size: xx-small; mso-highlight: white;"><span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>} </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="background: white; color: black; font-family: consolas; font-size: xx-small; mso-highlight: white;"><span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>} </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal; padding-left: 60px;" align="left"><span style="background: white; color: black; font-family: consolas; font-size: xx-small; mso-highlight: white;"><span>} </span></span></p>
<p class="MsoListParagraphCxSpLast" style="margin: 0in 0in 0pt 0.5in; line-height: normal; text-indent: -0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1; mso-layout-grid-align: none;"><span style="color: #000000;"><span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: ignore;"><span style="font-family: Calibri; font-size: small;">5.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Add a console application to the solution called RERWithoutPHADeploy. </span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; text-indent: -0.25in; mso-list: l0 level1 lfo1; mso-add-space: auto; mso-layout-grid-align: none;"><span style="color: #000000;"><span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: ignore;"><span style="font-family: Calibri; font-size: small;">6.</span><span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Add the &ldquo;OfficeDevPnP.Core&rdquo; NuGet reference to the RERWithoutPHADeploy as well. (Once again, you really only need a reference to Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll). </span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; text-indent: -0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1; mso-layout-grid-align: none;"><span style="background: white; color: black; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-highlight: white;"><span style="mso-list: ignore;"><span style="font-family: Calibri; font-size: small;">7.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-family: Calibri;"><span style="color: #000000; font-size: small;">Add the following code to your &ldquo;Main&rdquo; Method in the console app.<span style="mso-spacerun: yes;">&nbsp; </span>Be sure to add<br /></span><span style="font-size: 9.5pt; background: white; color: blue; mso-bidi-font-family: consolas; mso-highlight: white;">using</span><span style="font-size: 9.5pt; background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;"> Microsoft.SharePoint.Client<br /></span></span><span style="color: black; mso-bidi-font-family: consolas;"><span style="font-family: Calibri; font-size: small;">above your namespace declaration.<br /><br />Also, I wrote this on one of my VM&rsquo;s so the logged on user had rights to run the code, if you&rsquo;re deploying to o365 you&rsquo;ll need to create an instance of SharePointOnlineCredentials and set it to the clientContext.Credentials, if on-prem using NTLM but not the user you&rsquo;re logged in as then use NetworkCredentials.&nbsp; <br /></span></span><span style="font-size: 9.5pt; color: black; mso-bidi-font-family: consolas;"> <br /></span><span style="color: #000000; font-family: Calibri; font-size: small;">This&nbsp;code verbose for example purposes, it is more efficient in the supplied code sample. <br /></span><span style="font-size: 8pt; color: black; mso-bidi-font-family: consolas;"><span style="font-size: 8pt; color: black; mso-bidi-font-family: consolas;"> <br /><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: blue; mso-bidi-font-family: consolas; mso-highlight: white;">string</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;"> sharePointUrl = </span><span style="background: white; color: #a31515; mso-bidi-font-family: consolas; mso-highlight: white;">"&lt;the url for your SharePoint site&gt;"</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">; </span></span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: blue; mso-bidi-font-family: consolas; mso-highlight: white;">string</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;"> remoteWebUrl = </span><span style="background: white; color: #a31515; mso-bidi-font-family: consolas; mso-highlight: white;">"&lt;the url for your web site where the RER is hosted&gt;"</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: blue; mso-bidi-font-family: consolas; mso-highlight: white;">string</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;"> listName = </span><span style="background: white; color: #a31515; mso-bidi-font-family: consolas; mso-highlight: white;">"&lt;The name of the SharePoint list&gt;"</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">;<br /><br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: green; mso-bidi-font-family: consolas; mso-highlight: white;">// If you are authenticating onPrem as the user you&rsquo;re in as then this will work fine, else <br />// you&rsquo;ll need to pass an instantiation of a class that implements </span><span style="color: green; mso-bidi-font-family: consolas;">ICredentials to the clientContext.Credentials property</span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">ClientContext</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;"> clientContext = </span><span style="background: white; color: blue; mso-bidi-font-family: consolas; mso-highlight: white;">new</span><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">ClientContext</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">(sharePointUrl);<br /><br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">List</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;"> targetList = clientContext.Web.Lists.GetByTitle(listName); </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="background: white; color: black; font-size: xx-small; mso-bidi-font-family: consolas; mso-highlight: white;"><span style="font-family: Consolas;">clientContext.Load(targetList); </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverDefinitionCollection</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;"> ec = targetList.EventReceivers; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="background: white; color: black; font-size: xx-small; mso-bidi-font-family: consolas; mso-highlight: white;"><span style="font-family: Consolas;">clientContext.Load(ec);<br /><br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverDefinitionCreationInformation</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;"> eventReceiver = </span><span style="background: white; color: blue; mso-bidi-font-family: consolas; mso-highlight: white;">new</span><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverDefinitionCreationInformation</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">(); </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.EventType = </span><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverType</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">.ItemUpdating; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: green; mso-bidi-font-family: consolas; mso-highlight: white;">// The ReceiverAssembly and ReceiverClass properties, as far as I can tell, are not needed, at <br />// least for this example, the RER gets deployed and functions properly with or without them, you </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: green; mso-bidi-font-family: consolas; mso-highlight: white;">// may choose to use them for completeness</span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: green; mso-bidi-font-family: consolas; mso-highlight: white;">// they are, as far as I can tell holdovers from FTC Event Receivers, I could be wrong, don&rsquo;t shoot!</span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: green; mso-bidi-font-family: consolas; mso-highlight: white;">//eventReceiver.ReceiverAssembly = "RERWithoutPHA";</span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: green; mso-bidi-font-family: consolas; mso-highlight: white;">//eventReceiver.ReceiverClass = "RERWithoutPHA.Services.RERSynchronous";</span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.ReceiverName = </span><span style="background: white; color: #a31515; mso-bidi-font-family: consolas; mso-highlight: white;">"RERSynchronous"</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.ReceiverUrl = remoteWebUrl + </span><span style="background: white; color: #a31515; mso-bidi-font-family: consolas; mso-highlight: white;">"/RERSynchronous.svc"</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="background: white; color: black; font-size: xx-small; mso-bidi-font-family: consolas; mso-highlight: white;"><span style="font-family: Consolas;">eventReceiver.SequenceNumber = 1000; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.Synchronization = </span><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverSynchronization</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">.Synchronous; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="background: white; color: black; font-size: xx-small; mso-bidi-font-family: consolas; mso-highlight: white;"><span style="font-family: Consolas;">targetList.EventReceivers.Add(eventReceiver);<br /><br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver = </span><span style="background: white; color: blue; mso-bidi-font-family: consolas; mso-highlight: white;">new </span><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverDefinitionCreationInformation</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">(); </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.EventType = </span><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverType</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">.ItemAdding; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.ReceiverName = </span><span style="background: white; color: #a31515; mso-bidi-font-family: consolas; mso-highlight: white;">"RERSynchronous"</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.ReceiverUrl = remoteWebUrl + </span><span style="background: white; color: #a31515; mso-bidi-font-family: consolas; mso-highlight: white;">"/RERSynchronous.svc"</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="background: white; color: black; font-size: xx-small; mso-bidi-font-family: consolas; mso-highlight: white;"><span style="font-family: Consolas;">eventReceiver.SequenceNumber = 1000; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.Synchronization = </span><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverSynchronization</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">.Synchronous; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="background: white; color: black; font-size: xx-small; mso-bidi-font-family: consolas; mso-highlight: white;"><span style="font-family: Consolas;">targetList.EventReceivers.Add(eventReceiver); <br /><br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver = </span><span style="background: white; color: blue; mso-bidi-font-family: consolas; mso-highlight: white;">new</span><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverDefinitionCreationInformation</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">(); </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.EventType = </span><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverType</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">.ItemDeleting; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.ReceiverName = </span><span style="background: white; color: #a31515; mso-bidi-font-family: consolas; mso-highlight: white;">"RERSynchronous"</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: xx-small;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.ReceiverUrl = remoteWebUrl + </span><span style="background: white; color: #a31515; mso-bidi-font-family: consolas; mso-highlight: white;">" /RERSynchronous.svc"</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">; </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="background: white; color: black; font-size: xx-small; mso-bidi-font-family: consolas; mso-highlight: white;"><span style="font-family: Consolas;">eventReceiver.SequenceNumber = 1000; </span></span></p>
<p class="MsoListParagraphCxSpLast" style="margin: 0in 0in 0pt 0.5in; line-height: normal; mso-add-space: auto; mso-layout-grid-align: none;"><span style="font-size: xx-small;"><span style="font-family: Consolas;"><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">eventReceiver.Synchronization = </span><span style="background: white; color: #2b91af; mso-bidi-font-family: consolas; mso-highlight: white;">EventReceiverSynchronization</span><span style="background: white; color: black; mso-bidi-font-family: consolas; mso-highlight: white;">.Synchronous; <br /></span></span><span style="background: white; color: black; line-height: 107%; font-family: 'Calibri','sans-serif'; mso-bidi-font-family: consolas; mso-highlight: white; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;"><span style="font-family: Consolas;">targetList.EventReceivers.Add(eventReceiver);<br /><br />clientContext.Web.Context.ExecuteQuery();</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; text-indent: -0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1; mso-layout-grid-align: none;"><span style="color: black; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: ignore;"><span style="font-family: Calibri; font-size: small;">8.&nbsp;&nbsp; </span></span></span><span style="color: black; mso-bidi-font-family: consolas;"><span style="font-size: small;"><span style="font-family: Calibri;">Run the console app to deploy the RER&rsquo;s to SharePoint </span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; line-height: normal; text-indent: -0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1; mso-layout-grid-align: none;"><span style="color: #000000;"><span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: ignore;"><span style="font-family: Calibri; font-size: small;">9.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Ensure that your web site is up and running (preferably for testing in debug so you can see the event happening in code). </span></span></span></p>
<p class="MsoListParagraphCxSpLast" style="margin: 0in 0in 0pt 0.5in; line-height: normal; text-indent: -0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1; mso-layout-grid-align: none;"><span style="color: #000000;"><span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: ignore;"><span style="font-family: Calibri; font-size: small;">10.</span><span style="font: 7pt 'Times New Roman';">&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Add/edit/delete items from your list and watch the sparks fly, no PHA required!<br /><br /></span></span></span><span style="color: #000000; font-family: Calibri; font-size: small;">That&rsquo;s it!<span style="mso-spacerun: yes;">&nbsp; </span>Please do have a look at the code sample in <a href="https://github.com/danbudimir/RERWithoutPHA">GitHub</a>, the code&rsquo;s a bit nicer.&nbsp; But... provided as is.</span></p>]]></content:encoded>
    </item>
    <item>
      <title>The Azure Access Control service is unavailable in a Provider Hosted App on prem after disabling SSL 3.0</title>
      <link>https://docs.microsoft.com/archive/blogs/boodablog/the-azure-access-control-service-is-unavailable-in-a-provider-hosted-app-on-prem-after-disabling-ssl-3-0</link>
      <pubDate>Mon, 24 Nov 2014 16:04:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Budimir]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/boodablog/2014/11/24/the-azure-access-control-service-is-unavailable-in-a-provider-hosted-app-on-prem-after-disabling-ssl-3-0/</guid>
      <description><![CDATA[The short answer&hellip;
If you disable SSL 3.0 on your remote web server and you are using remote...]]></description>
      <content:encoded><![CDATA[<p><strong>The short answer&hellip;</strong></p>
<p>If you disable SSL 3.0 on your remote web server and you are using remote event receivers then you must also disable SSL 3.0 on your SharePoint WFE&rsquo;s.</p>
<p><strong>The long answer&hellip;</strong></p>
<p>This is a complicated one with a lot of moving parts and I&rsquo;m still not sure about the root cause.&nbsp; There are other reasons for this error that I&rsquo;ve researched, but this is my tale.</p>
<p>There are some prerequisites that must be in place in order to see this behavior</p>
<p>1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;You're running on prem (or possibly a cloud VM that has not had it's SCHANNEL settings changed from the default) and the SharePoint WFE is running on a different machine than is your Provider Hosted App.</p>
<p>2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You are using Remote Event Receivers</p>
<p>Recently, the project I&rsquo;m working on underwent an information security review, one of the issues raised was that SSL 3.0 was enabled on our remote web server.&nbsp; SSL 3.0 is prone to the POODLE attack, a pretty tough hack to throw but a vulnerability nonetheless. Now in the environment that we were using for the review we had no control over the SharePoint farm but we did have control over the remote web server where the Provider Hosted App runs.&nbsp; Ok, no big deal, we&rsquo;ll just shut off SSL 3.0 on our web server and be done with it.&nbsp; There are plenty of posts detailing the process for enabling and disabling different SCHANNEL protocols, <a href="https://www.sslshopper.com/article-how-to-disable-ssl-2.0-in-iis-7.html">this is one</a>.</p>
<p>Everything seemed to be working well, the app itself was fine, pages rendering and data through the high trust connection was retrieved with no problem.&nbsp; But then I noticed that our Remote Event Receivers (RERs) weren't firing, we do some data entry validation in our RERs and I was not seeing the validation error messages that it sends back to SharePoint.&nbsp; So a colleague started looking though the ULS and found this</p>
<p><span style="color: #ff0000;">App token requested from appredirect.aspx for site: 11111111-1111-1111-1111-111111111111 but there was an error in generating it.</span><br /><span style="color: #ff0000;">This may be a case when we do not need a token or when the app principal was not properly set up.</span><br /><span style="color: #ff0000;">LaunchUrl:https://app-myapp.mydomain.net/Pages/DataEntry.aspx?SPHostUrl=https://myapp.mydomain.net&amp;SPLanguage=en-US&amp;SPClientTag=0&amp;SPProductNumber=15.0.4631.1000&amp;SPAppWebUrl=https://App-11111111111111.mydomainpphost.net/myapp&amp;SPListItemId=1&amp;SPListId={11111111-1111-1111-1111-111111111111}</span><br /><span style="color: #ff0000;">Exception Message:The Azure Access Control service is unavailable. </span><br /><span style="color: #ff0000;">Stacktrace:&nbsp;&nbsp;&nbsp; at Microsoft.SharePoint.ApplicationServices.SPApplicationContext.GetApplicationSecurityTokenServicesUri(SPServiceContext serviceContext) </span><br /><span style="color: #ff0000;">at Microsoft.SharePoint.ApplicationServices.SPApplicationContext..ctor(SPServiceContext serviceContext, SPIdentityContext userIdentity, OAuth2EndpointIdentity applicationEndPoint) &nbsp; &nbsp;</span><br /><span style="color: #ff0000;">at Microsoft.SharePoint.SPSecurityContext.SecurityTokenForApplicationContext(SPIdentityContext userIdentityContext, String applicationId, Uri applicationRealm, SPApplicationContextAccessTokenType applicationTokenType, SPApplicationDelegationConsentType consentValue) &nbsp; &nbsp;</span><br /><span style="color: #ff0000;">at Microsoft.SharePoint.SPServerToAppServerAccessTokenManager.GetAccessTokenPrivate(SPServiceContext serviceContext, String appId, Uri appEndpointUrl, SPAppPrincipalInfo appPrincipal, SPApplicationContextAccessTokenType tokenType, Boolean useThreadIdentity, SPUserToken userToken) &nbsp; &nbsp;</span><br /><span style="color: #ff0000;">at Microsoft.SharePoint.SPServerToAppServerAccessTokenManager.GetAccessTokenFromThreadIdentityOrUserToken(SPServiceContext serviceContext, String appId, Uri appEndpointUrl, SPApplicationContextAccessTokenType tokenType, SPAppPrincipalInfo appPrincipal, Boolean useThreadIdentity, SPUserToken userToken)</span><br /><span style="color: #ff0000;">at Microsoft.SharePoint.ApplicationPages.AppRedirectPage.ValidateAndProcessRequest(). </span><br /><span style="color: #ff0000;">Since this is a nonfatal error, it will be sanitized and posted to the app as part of the app launch.</span></p>
<p>We are on prem and not using ACS, the error message is misleading. &nbsp;So I tested the scenario in a farm where I had full control of all machines and tried the same steps with the same result.&nbsp; I then disabled SSL 3.0 on the SharePoint WFE as well and then everything started working.&nbsp; All good but I&rsquo;m still at a loss as to why the SCHANNEL connection would not start with or at least fail over to TLS 1.0, which was enabled on both servers and is more secure.&nbsp; It may be that weak ciphers need to be disabled, etc., etc.&nbsp; I just haven&rsquo;t had the time to pursue it.</p>
<p>What I ended up with was TLS 1.0,1.1,1.2 enabled and SSL 2.0,3.0 disabled on SP WFE&rsquo;s and remote web servers.</p>
<p>Before I close out I did test unsuccessfully with some other SCHANNEL settings as well and here are some of the results</p>
<p>1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SSL 3.0, SSL 2.0, TLS 1.0 disabled and TLS 1.1, 1.2 enabled on WFE and remote web server.<br /><br /> SharePoint responds with a blank page, login is not requested.&nbsp; Non starter here, not sure if this is possibly a cert issue.</p>
<p>2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SSL 3.0, SSL 2.0, TLS 1.0 are disabled, TLS 1.1, 1.2 are enabled on remote web server,<br /> SSL 2.0 is disabled, SSL 3.0 TLS 1.0, 1.1, 1.2 are enabled on SharePoint WFE.<br /> <br /><span style="color: #ff0000;"> ERROR: The client and server cannot communicate, because they do not possess a common algorithm</span><br /> <br /> TLS 1.0 at least must be enabled, when TLS 1.0 is disabled on the remote web server the connection through the high trust cert to SharePoint is trying to find a common algorithm and I'm assuming the cert cannot do TLS 1.1 or 1.2 or the SharePoint server cannot handle TLS 1.1, 1.2.</p>
<p>I've gone so far as to decompile the SharePoint assemblies and begin jumping through the code but there is more research to be done here and I hope to have some time soon, but until then hopefully this information will help somebody. &nbsp;Please chime in if you have any input.</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint View CAML [Me] query not returning items belonging to me even though I'm logged on as...  Me.</title>
      <link>https://docs.microsoft.com/archive/blogs/boodablog/sharepoint-view-caml-me-query-not-returning-items-belonging-to-me-even-though-im-logged-on-as-me</link>
      <pubDate>Mon, 24 Nov 2014 08:05:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Budimir]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/boodablog/2014/11/24/sharepoint-view-caml-me-query-not-returning-items-belonging-to-me-even-though-im-logged-on-as-me/</guid>
      <description><![CDATA[The short answer... &nbsp;When creating a view through code that targets a field of type "User", the...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: small;">The short answer... &nbsp;When creating a view through code that targets a field of type "User", the following CAML will not work</span></p>
<p><span style="color: #ff0000; font-size: small;">&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name="MyUserField" /&gt;&lt;Value Type="User"&gt;[Me]&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;</span><br /><span style="font-size: small;"> nor this</span><br /><span style="color: #ff0000; font-size: small;"> &lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name="MyUserField" LookupId="True" /&gt;&lt;Value Type="User"&gt;[Me]&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;</span><br /><span style="font-size: small;"> nor this</span><br /><span style="color: #ff0000; font-size: small;"> &lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name="MyUserField" LookupId="True" /&gt;&lt;Value Type="Lookup"&gt;[Me]&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;</span><br /> <br /><span style="font-size: small;"> this works</span></p>
<p><span style="color: #ff0000; font-size: small;">&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name="MyUserField" /&gt;&lt;Value Type="Integer"&gt;&lt;UserID Type="Integer" /&gt;&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;</span></p>
<p><span style="font-size: small;">The long answer...</span></p>
<p><span style="font-size: small;">I recently created a view through C# CSOM to return records where the logged on user was equal to the value of a &ldquo;User&rdquo; field.&nbsp; Oddly, no records were returned when I looked at the view, even though my user account was the value of this field in several list items.&nbsp; Even more puzzling, when I edited the view through the SharePoint UI, it looked correct.&nbsp; Even more puzzling still, if I clicked the OK button to save the view it started working and all of the records where the &ldquo;User&rdquo; field was equal to &ldquo;Me&rdquo; were displayed.</span></p>
<p><span style="font-size: small;">&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/03/8535.Mefilter.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-03/8535.Mefilter.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/03/8535.Mefilter.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-03/8535.Mefilter.png" alt="" border="0" /></a></span></p>
<p><span style="font-size: small;">So I used <a href="https://spm.codeplex.com/">SharePoint Manager</a> to do a comparison of what my query looked like before and after I clicked the OK button through the UI and noticed that my query had been changed from</span></p>
<p><span style="color: #ff0000; font-size: small;">&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name="MyUserField" /&gt;&lt;Value Type="User"&gt;[Me]&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;</span></p>
<p><span style="font-size: small;">To</span></p>
<p><span style="color: #ff0000; font-size: small;">&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=" MyUserField " /&gt;&lt;Value Type="Integer"&gt;&lt;UserID Type="Integer" /&gt;&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;</span></p>
<p><span style="font-size: small;"><a href="https://spm.codeplex.com/">SharePoint Manager</a> is an awesome tool for plumbing the depths and getting down to the nitty gritty of all of the objects in your farm, if&nbsp;you've&nbsp;not tried it, you should.</span></p>
<p>&nbsp;<br /><span style="font-size: small;">The final code comes out looking something&nbsp;like this</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">ClientContext cc = <span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #0000ff;">new </span></span></span><span style="color: #2b91af;"><span style="color: #2b91af;"><span style="color: #2b91af;">ClientContext</span></span></span>(<span style="color: #a31515;"><span style="color: #a31515;"><span style="color: #a31515;"><a href="https://my.SharePoint.url">https://my.SharePoint.url</a></span></span></span>);<br />List l = cc.Web.GetListByTitle(<span style="color: #a31515;"><span style="color: #a31515;"><span style="color: #a31515;">"My List"</span></span></span>);<br />string[] viewFieldsArray = <span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #0000ff;">null</span></span></span>;<br />Systen.Collections.Generic.List&nbsp;&nbsp;&lt;<span style="color: #2b91af;"><span style="color: #2b91af;"><span style="color: #2b91af;">String</span></span></span>&gt; viewFields = <span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #0000ff;">new </span></span></span><span style="color: #2b91af;"><span style="color: #2b91af;"><span style="color: #2b91af;">List</span></span></span>&lt;<span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #0000ff;">string</span></span></span>&gt;();<br />viewFields.Add(<span style="color: #a31515;"><span style="color: #a31515;"><span style="color: #a31515;">"LinkTitle"</span></span></span>);<br />viewFields.Add(<span style="color: #a31515;"><span style="color: #a31515;"><span style="color: #a31515;">"Field 1"</span></span></span>);<br />viewFields.Add(<span style="color: #a31515;"><span style="color: #a31515;"><span style="color: #a31515;">"Field 2"</span></span></span>);<br />viewFieldsArray = viewFields.ToArray();</span><br /><span style="font-family: arial,helvetica,sans-serif; font-size: small;">string&nbsp;filter = <span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #0000ff;">string</span></span></span>.Format(<span style="color: #a31515;"><span style="color: #a31515;"><span style="color: #a31515;">"&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=\"MyUserField\" /&gt;&lt;Value Type=\"Integer\"&gt;&lt;UserID Type=\"Integer\" /&gt;&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;"</span></span></span>);<br />l.Views.Add(<span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #0000ff;">new </span></span></span><span style="color: #2b91af;"><span style="color: #2b91af;"><span style="color: #2b91af;">ViewCreationInformation</span></span></span>() { Title = <span style="color: #a31515;"><span style="color: #a31515;"><span style="color: #a31515;">"My Records"</span></span></span>, ViewFields = viewFieldsArray, Query = filter, RowLimit = 30, Paged = <span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #0000ff;">true</span></span></span>, SetAsDefaultView = <span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #0000ff;">false</span></span></span> });<br />cc.ExecuteQuery();</span></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Auto collapse multi-valued refiners in the SharePoint 2013 search refinement panel</title>
      <link>https://docs.microsoft.com/archive/blogs/boodablog/auto-collapse-multi-valued-refiners-in-the-sharepoint-2013-search-refinement-panel</link>
      <pubDate>Mon, 27 Oct 2014 19:59:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Budimir]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/boodablog/2014/10/27/auto-collapse-multi-valued-refiners-in-the-sharepoint-2013-search-refinement-panel/</guid>
      <description><![CDATA[My client asked if it was possible to auto-collapse the refinement panel and I thought to...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">My client asked if it was possible to auto-collapse the refinement panel and I thought to myself...&nbsp; that should be a setting right?&nbsp; Probably something that I had just never used or needed, it's got to be there.&nbsp; </span></p>
<p><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">No.</span></p>
<p><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">So I found <a href="https://devspoint.wordpress.com/2013/07/03/auto-collapse-search-refinement-panel-in-sharepoint-2013/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+SharepointApplicationDevelopment+%28SharePoint+Dev+Notes%29">this great post</a> that gives some good instruction on how to modify Filter_Default.html to allow single valued refiners to appear collapsed when the page is initially rendered.<span style="mso-spacerun: yes;">&nbsp; </span>Awesome, 1 down.</span></p>
<p><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">But this didn't work for multi valued refiners because they use a different template, well... actually 2 templates, Filter_MultiValue.html and Filter_MultiValue_Body.html.&nbsp; Ok, simple enough, we just have to make some mods to both files.&nbsp; First, we&nbsp;edit Filter_MultiValue.html to add a line to set its defaulted state to collapsed.</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var hasNoListData = ($isEmptyArray(listData));</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var propertyName = ctx.RefinementControl.propertyName;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var displayTitle = Srch.Refinement.getRefinementTitle(ctx.RefinementControl);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var isExpanded = Srch.Refinement.getExpanded(ctx.RefinementControl.propertyName);<br /> <br /> </span><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;becomes</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var hasNoListData = ($isEmptyArray(listData));</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var propertyName = ctx.RefinementControl.propertyName;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var displayTitle = Srch.Refinement.getRefinementTitle(ctx.RefinementControl);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">Srch.Refinement.setExpanded(ctx.RefinementControl.propertyName, false);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var isExpanded = Srch.Refinement.getExpanded(ctx.RefinementControl.propertyName);</span><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen;"><br /> <br /> </span><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">Now on to Filter_MultiValue_Body.html, and before I go much further, I&rsquo;ve found what I consider a bug but generally, it would never be noticed <span style="mso-spacerun: yes;">&nbsp;</span>because the default state for any refiner is expanded.</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">Notice in Filter_MultiValue.html the line</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var isExpanded = Srch.Refinement.getExpanded(ctx.RefinementControl.propertyName);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"> <br /> Now you would think that this function would return a boolean type variable, but it doesn&rsquo;t, it&rsquo;s a string.<span style="mso-spacerun: yes;">&nbsp; </span></span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;">Srch.Refinement.getExpanded = </span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">function</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> (f) {</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">var</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> e = </span><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white; mso-highlight: white;">"refinementExpandCookieName_"</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> + f,</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>a = document.cookie;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">if</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> (!Srch.U.e(a)) {</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">var</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> b = a.indexOf(e + </span><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white; mso-highlight: white;">"="</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;">);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">if</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> (b !== -1) {</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>b = b + e.length + 1;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">var</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> d = a.indexOf(</span><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white; mso-highlight: white;">";"</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;">, b);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">if</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> (d === -1) d = a.length;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">var</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> c = a.substring(b, d);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">if</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> (!Srch.U.n(c)) c = unescape(c);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">return</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"> c</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">return</span><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white; mso-highlight: white;">"true"</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;">};</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">Now take a look at the bottom of the file where our isExpanded string variable is saved for use in Filter_MultiValue_Body.html, the value of isExpanded is a string value of &ldquo;false&rdquo;.</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">ctx.RefinementControl["csr_isExpanded"] = isExpanded;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">Now let&rsquo;s take a look at Filter_MultiValue_Body.html, notice the line </span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var isExpanded = Boolean(ctx.RefinementControl["csr_isExpanded"]);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">The JavaScript &ldquo;Boolean&rdquo; function when given a single string as an argument will return false only if the string is blank, this means that a string with a value of &ldquo;false&rdquo; will return true.<span style="mso-spacerun: yes;">&nbsp; </span>So, to be clear, any string with 1 or more characters will return true from the &ldquo;Boolean&rdquo; function.<span style="mso-spacerun: yes;">&nbsp; </span>So you can see the problem, upon rendering, the isExpanded variable in Filter_MultiValue_Body.html is always true.</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">I ran into another issue that was really just unexpected behavior, when you would select a few items to refine on, then click the "Apply" button, the entire refiner would hide itself again.<span style="mso-spacerun: yes;">&nbsp; </span>Duh, that&rsquo;s what I told it to do.<span style="mso-spacerun: yes;">&nbsp; </span>I had to add some code to determine if there were some refiners selected and override the collapsed state.</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">Anyway, here&rsquo;s the code in Filter_MultiValue_Body.html.</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">&lt;!--#_</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var propertyName = ctx.RefinementControl["csr_propertyName"];</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var displayTitle = ctx.RefinementControl["csr_displayTitle"];</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var filters = ctx.RefinementControl["csr_filters"];</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var isExpanded = Boolean(ctx.RefinementControl["csr_isExpanded"]);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var renderEmptyContainer = Boolean(ctx.RefinementControl["csr_renderEmptyContainer"]);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var useContains = Boolean(ctx.RefinementControl["csr_useContains"]);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var useKQL = Boolean(ctx.RefinementControl["csr_useKQL"]);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var showCounts = Boolean(ctx.RefinementControl["csr_showCounts"]);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">if($isEmptyString(propertyName) || (!$isNull(renderEmptyContainer) &amp;&amp; renderEmptyContainer))</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">{ </span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">_#--&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">&lt;</span><span style="font-size: 9.5pt; font-family: Consolas; color: maroon; background: white; mso-highlight: white;">div</span><span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">id</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="EmptyContainer"&gt;&lt;/</span><span style="font-size: 9.5pt; font-family: Consolas; color: maroon; background: white; mso-highlight: white;">div</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">&lt;!--#_</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">} </span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">else if(!$isNull(filters) &amp;&amp; Srch.U.isArray(filters) &amp;&amp; !$isEmptyArray(filters))</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">{ </span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>var expandedStatus = !$isNull(isExpanded) ? isExpanded : true;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>var iconClass = "ms-core-listMenu-item ";</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>iconClass += expandedStatus ? "ms-ref-uparrow" : "ms-ref-downarrow";</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">_#--&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">&lt;</span><span style="font-size: 9.5pt; font-family: Consolas; color: maroon; background: white; mso-highlight: white;">div</span><span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">id</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="Container"&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_#= Srch.U.collapsibleRefinerTitle(propertyName, ctx.ClientControl.get_id(), displayTitle, iconClass) =#_</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">&lt;</span><span style="font-size: 9.5pt; font-family: Consolas; color: maroon; background: white; mso-highlight: white;">div</span><span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">class</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="ms-ref-unselSec"</span> <span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">id</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="UnselectedSection"&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">&lt;</span><span style="font-size: 9.5pt; font-family: Consolas; color: maroon; background: white; mso-highlight: white;">div</span><span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">id</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="unselShortList"</span> <span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">class</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="ms-ref-unsel-shortList"&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">Becomes</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">&lt;!--#_</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var propertyName = ctx.RefinementControl["csr_propertyName"];</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var displayTitle = ctx.RefinementControl["csr_displayTitle"];</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var filters = ctx.RefinementControl["csr_filters"];</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var isExpanded = ctx.RefinementControl["csr_isExpanded"];</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var renderEmptyContainer = Boolean(ctx.RefinementControl["csr_renderEmptyContainer"]);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var useContains = Boolean(ctx.RefinementControl["csr_useContains"]);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var useKQL = Boolean(ctx.RefinementControl["csr_useKQL"]);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">var showCounts = Boolean(ctx.RefinementControl["csr_showCounts"]);</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">if($isEmptyString(propertyName) || (!$isNull(renderEmptyContainer) &amp;&amp; renderEmptyContainer))</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">{ </span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">_#--&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">&lt;</span><span style="font-size: 9.5pt; font-family: Consolas; color: maroon; background: white; mso-highlight: white;">div</span><span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">id</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="EmptyContainer"&gt;&lt;/</span><span style="font-size: 9.5pt; font-family: Consolas; color: maroon; background: white; mso-highlight: white;">div</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">&lt;!--#_</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">} </span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">else if(!$isNull(filters) &amp;&amp; Srch.U.isArray(filters) &amp;&amp; !$isEmptyArray(filters))</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">{ </span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>var expandedStatus = !$isNull(isExpanded) ? (isExpanded == "true" ? true : false) : true;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span></span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>if (!expandedStatus) {</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>for (var i = 0; i &lt; filters.length; i++) {</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>var filter = filters[i];</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if(!$isNull(filter)) {</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if (Boolean(filter.IsSelected) == true)</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>expandedStatus = true;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>break;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>};</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>var iconClass = "ms-core-listMenu-item ";</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>iconClass += expandedStatus ? "ms-ref-uparrow" : "ms-ref-downarrow";</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>var displayStyle = expandedStatus ? "" : "none";</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: darkgreen; background: white; mso-highlight: white;">_#--&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">&lt;</span><span style="font-size: 9.5pt; font-family: Consolas; color: maroon; background: white; mso-highlight: white;">div</span><span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">id</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="Container"&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_#= Srch.U.collapsibleRefinerTitle(propertyName, ctx.ClientControl.get_id(), displayTitle, iconClass) =#_</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">&lt;</span><span style="font-size: 9.5pt; font-family: Consolas; color: maroon; background: white; mso-highlight: white;">div</span><span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">class</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="ms-ref-unselSec"</span> <span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">id</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="UnselectedSection"</span><span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">style</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">='</span><span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">display</span><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;">:</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">_#=</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">$htmlEncode(displayStyle)</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">=#_'&gt;</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; mso-layout-grid-align: none; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">&lt;</span><span style="font-size: 9.5pt; font-family: Consolas; color: maroon; background: white; mso-highlight: white;">div</span><span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">id</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="unselShortList"</span> <span style="font-size: 9.5pt; font-family: Consolas; color: red; background: white; mso-highlight: white;">class</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white; mso-highlight: white;">="ms-ref-unsel-shortList"&gt;</span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/56/78/40/AutoCollapsedRefiners.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-56-78-40/AutoCollapsedRefiners.zip">AutoCollapsedRefiners.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>"Invalid provider type specified." when using a high trust cert that was created with CNG in a Provider Hosted App</title>
      <link>https://docs.microsoft.com/archive/blogs/boodablog/invalid-provider-type-specified-when-using-a-high-trust-cert-that-was-created-with-cng-in-a-provider-hosted-app</link>
      <pubDate>Sun, 05 Oct 2014 17:29:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Budimir]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/boodablog/2014/10/05/invalid-provider-type-specified-when-using-a-high-trust-cert-that-was-created-with-cng-in-a-provider-hosted-app/</guid>
      <description><![CDATA[The short solution:&nbsp; When generating a cert to be used for high trust in a Provider Hosted...]]></description>
      <content:encoded><![CDATA[<p>The short solution:&nbsp; When generating a cert to be used for high trust in a Provider Hosted application, choose&nbsp;"(no template) Legacy key", Microsoft RSA SChannel Cryptographic Provider.</p>
<p>The longer explanation: In my continuing journey with Provider Hosted applications, I've run into a new issue that is documented in other areas of Microsoft technology, but not SharePoint.&nbsp; I requested an enterprise cert that we would use for S2S high trust, typically certs that are generated for web environments are generated using a web site template, on Microsoft platforms the website templates typically use CNG (Cryptographic Next Generation) and IIS supports them just fine.&nbsp; High trust certs, unlike standard&nbsp;website SSL certs, are not imported into IIS and used to encrypt browser transactions, they are broken up into public and private key files (cer and pfx), the public key is used on the SharePoint server and the private key used on the remote web server.&nbsp; The files together provide&nbsp;secure encryption for the remote web and the SharePoint server to talk.&nbsp; We built our app in Visual Studio 2013 and the standard Provider Hosted Application template in Visual Studio comes with some great base code that handles all of the nitty gritty of using the private key to talk back to SharePoint.&nbsp; After setting up the key files and attempting to navigate to one of our I pages I received the error below.&nbsp; At the point where the TokenHelper class attempts to access the private key in the pfx file the error is thrown,&nbsp;the reason is that&nbsp;the crypto api does not support certs generated with CNG.&nbsp; See the short solution above.</p>
<p>&nbsp;</p>
<h1 style="color: red; font-family: Verdana; font-size: 18pt; font-weight: normal;">Server Error in '/' Application.</h1>
<hr size="1" width="100%" />
<h1 style="color: red; font-family: Verdana; font-size: 18pt; font-weight: normal;"><em>An internal error occurred.<br /></em><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><strong style="color: black; font-family: Verdana; font-weight: bold; margin-top: -5px;">Description:<span class="Apple-converted-space">&nbsp;</span></strong>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.<span class="Apple-converted-space">&nbsp;<br /></span><strong style="color: black; font-family: Verdana; font-weight: bold; margin-top: -5px;">Exception Details:<span class="Apple-converted-space">&nbsp;</span></strong>System.Security.Cryptography.CryptographicException: An internal error occurred.<br /><strong style="color: black; font-family: Verdana; font-weight: bold; margin-top: -5px;">Source Error:</strong><span class="Apple-converted-space">&nbsp;</span></span></span></span></span></h1>
<table style="width: 100%;" bgcolor="#ffffcc">
<tbody>
<tr>
<td><code>An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code></td>
</tr>
</tbody>
</table>
<h1 style="color: red; font-family: Verdana; font-size: 18pt; font-weight: normal;"><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><strong style="color: black; font-family: Verdana; font-weight: bold; margin-top: -5px;">Stack Trace:</strong><span class="Apple-converted-space">&nbsp;</span></span></span></span></span></h1>
<table style="width: 100%;" bgcolor="#ffffcc">
<tbody>
<tr>
<td>
<pre style="margin: 0px; padding: 0.5em; line-height: 14pt; font-family: Consolas, 'Lucida Console', monospace; font-size: 11pt;">[CryptographicException: An internal error occurred.
]
   System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) +41
   System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle&amp; pCertCtx) +0
   System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags) +307
   System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password) +84
   Foo.Web.TokenHelper..cctor() in c:\Foo\FooWeb\TokenHelper.cs:674

[TypeInitializationException: The type initializer for 'Foo.Web.TokenHelper' threw an exception.]
   Foo.Web.TokenHelper.IsHighTrustApp() in c:\Foo\FooWeb\TokenHelper.cs:618
   Foo.Web.SharePointContextProvider..cctor() in c:\Foo\FooWeb\SharePointContext.cs:307

[TypeInitializationException: The type initializer for Foo.Web.SharePointContextProvider' threw an exception.]
   Foo.Web.SharePointContextProvider.CheckRedirectionStatus(HttpContext httpContext, Uri&amp; redirectUrl) in c:\Foo\FooWeb\SharePointContext.cs:410
   Foo.Web.Default.Page_PreInit(Object sender, EventArgs e) in c:\Foo\FooWeb\Pages\Default.aspx.cs:15
   System.Web.UI.Page.PerformPreInit() +49
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1844
</pre>
</td>
</tr>
</tbody>
</table>
<h1 style="color: red; font-family: Verdana; font-size: 18pt; font-weight: normal;">&nbsp;</h1>
<hr size="1" width="100%" />
<h1 style="color: red; font-family: Verdana; font-size: 18pt; font-weight: normal;"><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><span style="font: 11px/normal Arial, Helvetica, Geneva, SunSans-Regular, sans-serif; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"><strong style="color: black; font-family: Verdana; font-weight: bold; margin-top: -5px;">Version Information:</strong>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446</span><br /></span></span></h1>]]></content:encoded>
    </item>
    <item>
      <title>You must forcibly set "Copy Local" to true when referencing SharePoint Client Object Model assemblies</title>
      <link>https://docs.microsoft.com/archive/blogs/boodablog/you-must-forcibly-set-copy-local-to-true-when-referencing-sharepoint-client-object-model-assemblies</link>
      <pubDate>Sat, 06 Sep 2014 11:04:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Budimir]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/boodablog/2014/09/06/you-must-forcibly-set-copy-local-to-true-when-referencing-sharepoint-client-object-model-assemblies/</guid>
      <description><![CDATA[I recently ran into an issue when deploying a provider hosted app on Prem. &nbsp;Everything ran...]]></description>
      <content:encoded><![CDATA[<p>I recently ran into an issue when deploying a provider hosted app on Prem. &nbsp;Everything ran perfect in my dev environment (of course it would, all on one machine), so I deployed to the remote web server in my distributed environment, a 3 server SharePoint farm and 1 remote web machine.<br /> <br /> I published my web site to my dev machine then copied the installer to my remote web server and deployed the web site. &nbsp;I then installed my app from the app catalog, the app installed OK but when forwarded to my landing page I received the infamous&nbsp;&ldquo;An error occurred while processing your request.&rdquo;. &nbsp;Now that error message is just built in to the <span style="color: #3366ff;">SharePointContext&nbsp;</span>class that comes with the ootb template for provider hosted apps, it doesn't really give you the whole story about what happened under the sheets.</p>
<p>I was thinking "well, it must be some issue with the high trust cert, maybe some oAuth problem, app manifest or web.config not right, etc. &nbsp;So I went off and checked all kinds of things and then almost accidentally I was looking at the bin directory and noticed that the SharePoint client assemblies were all missing. &nbsp;I then checked my Visual Studio assembly references for the project in question and noticed that "Copy Local" was false for all of the SharePoint client assemblies.</p>
<p>There are some very specific reasons for the "Copy Local" flag to be set to false and I don't think the SharePoint assemblies meet the criteria so I'm a bit in the dark about why this would happen in the first place.</p>
<ol>
<li>If the reference is another project, called a project-to-project reference, then the value is true.</li>
<li>If the assembly is found in the global assembly cache, the value is false.</li>
<li>As a special case, the value for the mscorlib.dll reference is false.</li>
<li>If the assembly is found in the Framework SDK folder, then the value is false.</li>
<li>Otherwise, the value is true.</li>
</ol>
<p>Anyway, lesson learned, always remember to check and verify the "Copy Local" flag is set to true on all assemblies that you've referenced unless you know they'll be in the GAC.</p>]]></content:encoded>
    </item>
    <item>
      <title>Taxonomy fields return as Dictionaries using the Client Objcet Model in SharePoint 2013</title>
      <link>https://docs.microsoft.com/archive/blogs/boodablog/taxonomy-fields-return-as-dictionaries-using-the-client-objcet-model-in-sharepoint-2013</link>
      <pubDate>Fri, 04 Jul 2014 07:51:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Budimir]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/boodablog/2014/07/04/taxonomy-fields-return-as-dictionaries-using-the-client-objcet-model-in-sharepoint-2013/</guid>
      <description><![CDATA[Recently, a collegue of mine&nbsp;and I ran into this issue.
The Problem:
Let's assume you execute...]]></description>
      <content:encoded><![CDATA[<p>Recently, a collegue of mine&nbsp;and I ran into this issue.</p>
<p><strong>The Problem:</strong></p>
<p>Let's assume you execute the following code against one of your SharePoint lists that contains taxonomy fields</p>
<p><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">List</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> oList = cc.Web.Lists.GetByTitle(listName);<br /></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">CamlQuery</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> camlQuery = </span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">new</span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">CamlQuery</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">();<br /></span></span>camlQuery.ViewXml = caml;<br /><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">ListItemCollection</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> collListItem = oList.GetItems(camlQuery);<br /></span></span>cc.Load(collListItem);<br />cc.ExecuteQuery();<br /><br />Firstly, we'll assume (and you must),&nbsp; you've added a reference to <strong>Microsoft.SharePoint.Client.Taxonomy</strong>.&nbsp; Without a reference to the taxonomy assembly SharePoint has no idea what to do with the taxonomy fields in collListItem.</p>
<p><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">But yet, you look at what is returned and notice that taxonomy fields are returning as dictionaries while all other fields return correctly.</span></p>
<p><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/03/0385.Bad.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-03/0385.Bad.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/03/0385.Bad.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-03/0385.Bad.png" alt="" border="0" /></a></span></p>
<p><strong><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">What's going on here?</span></strong></p>
<p><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">Looking at the data you can see that the dictionary for the taxonomy fields contains 2 fields<br /><br /></span>[0]: {[_ObjectType_, SP.Taxonomy.TaxonomyFieldValueCollection]}<br />[1]: {[_Child_Items_, System.Object[]]}</p>
<p>The first one, _ObjectType_, dictates what class SharePoint will use to house the data.</p>
<p>But wait, we referenced the taxonomy assembly&nbsp;in our&nbsp;project, why is this still returning as a dictionary?</p>
<p>The problem is that just because you reference an assembly does not automatically mean that the assembly will be loaded,&nbsp;assemblies may load when first used in your code.<br />When the <strong>ListItemCollection</strong> above is populated, <strong>Microsoft.SharePoint.Client.Taxonomy</strong> has not yet been loaded, the code checks to see if the <strong>SP.Taxonomy.TaxonomyFieldValueCollection</strong> class is available and if not you get a dictionary.</p>
<p><strong>The Solution</strong></p>
<p>You must force the <strong>Microsoft.SharePoint.Client.Taxonomy</strong> assembly to be loaded.<br />There are other ways to accomplish this but here is what&nbsp;we did.<br />Just before we execute the code to get&nbsp;our list data,&nbsp;we added this line.<br /><span style="color: #008000; font-family: Consolas; font-size: x-small;"><span style="color: #008000; font-family: Consolas; font-size: x-small;"><span style="color: #008000; font-family: Consolas; font-size: x-small;"><br />//*** dummy to force Microsoft.SharePoint.Client.Taxonomy.dll to be loaded<br /></span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">TaxonomyItem</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> dummy = </span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">new </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">TaxonomyItem</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">(clientContext,</span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">null</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">);<br /><br /></span></span>That did the trick.&nbsp;&nbsp;We also tried creating the <span style="font-size: small;"><span style="color: #2b91af; font-family: Consolas;"><span style="color: #2b91af; font-family: Consolas;"><span style="color: #2b91af; font-family: Consolas;">TaxonomyItem </span></span></span><strong></strong></span>as null thinking that might do it but it still failed, it had to be an actual instantiation.</p>
<p><strong>The final code</strong></p>
<p><span style="color: #008000; font-family: Consolas; font-size: x-small;"><span style="color: #008000; font-family: Consolas; font-size: x-small;"><span style="color: #008000; font-family: Consolas; font-size: x-small;">//*** dummy to force Microsoft.SharePoint.Client.Taxonomy.dll to be loaded<br /></span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">TaxonomyItem</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> dummy = </span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">new </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">TaxonomyItem</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">(clientContext,</span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">null</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">);<br /></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">List</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> oList = cc.Web.Lists.GetByTitle(listName);<br /></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">CamlQuery</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> camlQuery = </span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">new</span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">CamlQuery</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">();<br /></span></span>camlQuery.ViewXml = caml;<br /><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">ListItemCollection</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> collListItem = oList.GetItems(camlQuery);<br /></span></span>cc.Load(collListItem);<br />cc.ExecuteQuery();</p>
<p><strong>The result</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/63/03/4276.good.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-03/4276.good.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/03/4276.good.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-03/4276.good.png" alt="" border="0" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint 2013: A duplicate field name “&lt;GUID&gt;” was found re-creating a Taxonomy field using the Client Object Model</title>
      <link>https://docs.microsoft.com/archive/blogs/boodablog/sharepoint-2013-a-duplicate-field-name-guid-was-found-re-creating-a-taxonomy-field-using-the-client-object-model</link>
      <pubDate>Sat, 07 Jun 2014 08:53:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Budimir]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/boodablog/2014/06/07/sharepoint-2013-a-duplicate-field-name-guid-was-found-re-creating-a-taxonomy-field-using-the-client-object-model/</guid>
      <description><![CDATA[I&rsquo;ve been working on a SharePoint provider hosted app for a client and part of the overall...]]></description>
      <content:encoded><![CDATA[<div class="WordSection1">
<p class="MsoNormal">I&rsquo;ve been working on a SharePoint provider hosted app for a client and part of the overall solution is a deployment of artifacts to the Host web.<span style="mso-spacerun: yes;">&nbsp; </span>There are many valid and important reasons for having your app use the host web as its main data store opposed to the app web.<span style="mso-spacerun: yes;">&nbsp; </span>In short, if your app is considered the center piece of your site and is used to accomplish things you would have typically tried to do using full trust code in the past, the host web is probably your best bet.<span style="mso-spacerun: yes;">&nbsp; </span>If your app is a widget and you expect to install it in many sites then the app web is how you should probably go.<span style="mso-spacerun: yes;">&nbsp; </span>Just my 2 cents, probably worthy of another post to join the fray of opinions.<span style="mso-spacerun: yes;">&nbsp; </span>Just remember, if your app gets uninstalled, everything in the app web goes along with it.</p>
<p class="MsoNormal">Back to the issue, I&rsquo;ll try to keep it short and sweet.<span style="mso-spacerun: yes;">&nbsp; </span>I opted to create a console application to do the deployment to the host web.<span style="mso-spacerun: yes;">&nbsp; </span>At some point in SharePoint development you usually run into the scenario where you either delete the site collection or just delete some lists, content types, etc. and try to re-deploy for testing.</p>
<p class="MsoNormal">After deleting some of my custom site columns of type &ldquo;<span class="SpellE">TaxonomyFieldType</span>&rdquo; and &ldquo;<span class="SpellE">TaxonomyFieldTypeMulti</span>&rdquo;, I tried to run my deployment project and ran into this issue.</p>
<p class="MsoNormal"><span style="mso-no-proof: yes;"> <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/03/3566.mmsdelete.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-03/3566.mmsdelete.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/03/3566.mmsdelete.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-03/3566.mmsdelete.png" alt="" border="0" /></a></span></p>
<p class="MsoNormal">When you create a Taxonomy field, SharePoint actually creates 2 fields.<span style="mso-spacerun: yes;">&nbsp; </span>The first is the field that you created.<span style="mso-spacerun: yes;">&nbsp; </span>The second is a hidden, cryptically named, &ldquo;helper&rdquo; field.<span style="mso-spacerun: yes;">&nbsp; </span>When you delete a taxonomy field the hidden field is left behind.</p>
<p class="MsoNormal">The naming logic goes like this.<span style="mso-spacerun: yes;">&nbsp; </span>Take the id of the Taxonomy field, convert to lower case, remove all hyphens, <span class="GramE">then</span> replace the first character with another character.<span style="mso-spacerun: yes;">&nbsp; </span>I&rsquo;m not sure how the first character is derived, I just know it replaces the original first character</p>
<p class="MsoNormal">So, for example...<span style="mso-spacerun: yes;">&nbsp; </span>{787F977C-EA60-47F0-88B8-B7651J21CECE} becomes l87f977cea6047f088b8b7651j21cece,&nbsp;and l87f977cea6047f088b8b7651j21cece is the name of the hidden field.<span style="mso-spacerun: yes;">&nbsp; </span>So in order to truly delete a taxonomy field I wrote the following code to delete both fields.&nbsp; You could also attempt to create the field, catch the exception, extract the hidden field name from the exception message, delete the field again, then use the extracted hidden field name to delete the hidden field.<br /><br /><span class="GramE"><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">public </span></span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">static </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">void</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> <span class="SpellE">DeleteField</span>(</span><span class="SpellE"><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">ClientContext</span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> cc, </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> <span class="SpellE">internalName,<span style="color: blue;">string</span></span> id = </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">""</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">)<br /></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">{<br /></span><span class="SpellE"><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">&nbsp;&nbsp;&nbsp; FieldCollection</span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> fields = <span class="SpellE">cc.Web.Fields</span>;<br /></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="SpellE"><span class="GramE">cc.Web.Context.Load</span></span><span class="GramE">(</span>fields, fc =&gt; <span class="SpellE">fc.Include</span>(f =&gt; <span class="SpellE">f.Id</span>, f =&gt; <span class="SpellE">f.InternalName</span>));<br /></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="SpellE"><span class="GramE">cc.Web.Context.ExecuteQuery</span></span><span class="GramE">(</span>);<br /><br /></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span class="SpellE"><span class="GramE"><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">var</span></span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> field = <span class="SpellE">fields.FirstOrDefault</span>(f =&gt; <span class="SpellE">f.InternalName</span> == <span class="SpellE">internalName</span>);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; if (field != null)<br />&nbsp;&nbsp;&nbsp; {<br /></span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span class="GramE">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; id</span> = <span class="SpellE">field.Id.ToString</span>();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span class="SpellE"><span class="GramE">field.DeleteObject</span></span><span class="GramE">(</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span class="SpellE"><span class="GramE">cc.Web.Context.ExecuteQuery</span></span><span class="GramE">(</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">if</span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> (id != </span><span class="SpellE"><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">.Empty</span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">)<br />&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> <span class="SpellE">hiddenFieldName</span> = <span class="SpellE">id.ToLower</span>().Replace(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"-"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">, </span><span class="SpellE"><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">.Empty</span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">).Replace(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"{"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">, </span><span class="SpellE"><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">.Empty</span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">).Replace(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"}"</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">, </span><span class="SpellE"><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">string</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">.Empty</span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">).Substring(1); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span class="GramE">field</span> = <span class="SpellE">fields.FirstOrDefault</span>(f =&gt; <span class="SpellE">f.InternalName.EndsWith</span>(<span class="SpellE">hiddenFieldName</span>));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="GramE"><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">if</span></span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"> (field != </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">null</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span class="SpellE"><span class="GramE">field.DeleteObject</span></span><span class="GramE">(</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span class="SpellE"><span class="GramE">cc.Web.Context.ExecuteQuery</span></span><span class="GramE">(</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;"><span class="SpellE"><span class="GramE">cc.Web.Update</span></span><span class="GramE">(</span>);</span></p>
<p class="MsoNormal"><span style="background: white; color: black; line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">}</span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
</div>]]></content:encoded>
    </item>
    <item>
      <title>Greetings!</title>
      <link>https://docs.microsoft.com/archive/blogs/boodablog/greetings</link>
      <pubDate>Tue, 14 Jan 2014 13:28:54 GMT</pubDate>
      <dc:creator><![CDATA[Dan Budimir]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/boodablog/2014/01/14/greetings/</guid>
      <description><![CDATA[Hello everybody, I&nbsp;am&nbsp;a&nbsp;software engineer, designer, developer and technologist in...]]></description>
      <content:encoded><![CDATA[<p>Hello everybody, I&nbsp;am&nbsp;a&nbsp;software engineer, designer, developer and technologist in general.&nbsp; I've been doing this professionally for about oh... 26 years (Yike!)&nbsp;and have been with Microsoft for&nbsp;almost 3&nbsp;years.&nbsp;&nbsp;I've owned&nbsp;a software company, led numerous development projects, been a DBA, managed project schedules, development teams, etc. etc. ad infinitum.&nbsp;&nbsp;Assembler and COBOL to&nbsp;C++,C# and everything in between, this platform, that OS, web, desktop and mobile projects, yadda, yadda, I've seen a lot of programming fads and patterns come and go.&nbsp;&nbsp;I've solved a lot of problems over the years, truly, this is what drives my passion for technology, there's always something new to learn and always another hurdle to overcome.&nbsp;&nbsp;A simple search will generally find a plethora of others who have dealt with and overcome the&nbsp;issues your dealing with, occasionally though you run into that off the wall problem that no one&nbsp;else seems to be seeing and you have to combine solutions from others or come up with your own.&nbsp; Admittedly, I've been really lousy about sharing those experiences and the solutions that were carved out.&nbsp; You know how it is, you climb the mountain, get to the top, raise your arms in triumph and in&nbsp;that moment of unadulterated bliss, off in the distance, you see another mountain and off you go!&nbsp; I should have done a better job of sharing&nbsp;the experience with my peers, get a little input on where I may have&nbsp;gone awry and possibly help&nbsp;those dealing with the same issues.&nbsp; I'm going to try and rectify that by posting some of the issues I'm dealing with currently and I'm going to go back&nbsp;into the archive and pull out a few.</p>]]></content:encoded>
    </item>
  </channel>
</rss>