<?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>...Talk of Many Things...</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/manish_ahuja/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/manish_ahuja/feed.xml</link>
    <description>&amp;quot;The time has come,&amp;quot; the Walrus said, &amp;quot;to talk of many things&amp;quot;...</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:12:04 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>IE 10, HTML5 and jQuery 2.x - JavaScript runtime error: 'JSON' is undefined</title>
      <link>https://docs.microsoft.com/archive/blogs/manish_ahuja/ie-10-html5-and-jquery-2-x-javascript-runtime-error-json-is-undefined</link>
      <pubDate>Wed, 15 May 2013 13:45:00 GMT</pubDate>
      <dc:creator><![CDATA[Manish Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/manish_ahuja/2013/05/15/ie-10-html5-and-jquery-2-x-javascript-runtime-error-json-is-undefined/</guid>
      <description><![CDATA[While debugging HTML5 web pages with jQuery based scripts in Visual Studio 2012 using IE 10, if you...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: small;">While debugging HTML5 web pages with jQuery based scripts in Visual Studio 2012 using IE 10, if you see an error similar to following:</span></p>
<table style="width: 487px;" border="1" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="485">
<blockquote style="margin-right: 0px;" dir="ltr">
<p><span style="font-size: small;"><strong><span style="color: #ff0000;">Error</span></strong> <br />Unhandled exception at line XXX, column 1 in </span><a href="https://localhost:8135/Scripts/jquery-X.y.z.js"><span style="font-size: small;">https://localhost:8135/Scripts/jquery-X.y.z.js</span></a> <br /> <br /><span style="font-size: small;">0x800a1391 - JavaScript runtime error: 'JSON' is undefined</span></p>
</blockquote>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/65/12/metablogapi/0312.image_61F1EB3B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-65-12-metablogapi/0312.image_5F00_61F1EB3B.png"><img style="display: inline; background-image: none;" title="Associated Visual Studio 2012 Exception" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/65/12/metablogapi/7608.image_thumb_18EBC975.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-65-12-metablogapi/7608.image_5F00_thumb_5F00_18EBC975.png" alt="Associated Visual Studio 2012 Exception" width="562" height="320" border="0" /></a></p>
<p><span style="font-size: small;">And&nbsp; if you are able to debug the same page in Visual Studio 2012 using the latest versions of any of the following browsers without any issues:</span></p>
<ul>
<li><span style="font-size: small;">Opera, </span></li>
<li><span style="font-size: small;">Chrome, </span></li>
<li><span style="font-size: small;">Firefox and </span></li>
<li><span style="font-size: small;">Safari etc. </span></li>
</ul>
<p><span style="font-size: small;">Then make sure that Compatibility View settings in IE 10 are turned &ldquo;Off&rdquo; for the domain (or host name) of the IIS site where your page is hosted. In my case I found that &ldquo;localhost&rdquo; was added to Compatibility View, so just removing it from there solved the problem.</span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/65/12/metablogapi/3438.image_7E3F2D5B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-65-12-metablogapi/3438.image_5F00_7E3F2D5B.png"><img style="display: inline; background-image: none;" title="IE 10 Compatibility View Settings Dialog" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/65/12/metablogapi/3225.image_thumb_679CDF14.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-65-12-metablogapi/3225.image_5F00_thumb_5F00_679CDF14.png" alt="IE 10 Compatibility View Settings Dialog" width="399" height="494" border="0" /></a></p>
<p><span style="font-size: small;">For more details on why this is an issue, will recommend reading following MSDN article:</span></p>
<p><a href="https://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx" target="_blank"><span style="font-size: small;">Defining Document Compatibility</span></a></p>
<p>&nbsp;<strong>Update</strong> <strong>18-Aug-2013:</strong> Changed the blog title to reflect that this applies only to JQuery 2.x. ['JSON'&nbsp;is undefined] is not an issue with JQuery 1.x.&nbsp;</p>
<p>Following tables further&nbsp;detail out IE 10 behaviour across compatibility modes, settings and jQuery versions:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/65/12/7635.IE%2010%20and%20jQuery%202.x.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-65-12/7635.IE-10-and-jQuery-2.x.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/65/12/7635.IE%2010%20and%20jQuery%202.x.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-65-12/7635.IE-10-and-jQuery-2.x.png" alt="" width="747" height="279" border="0" /></a>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/65/12/6011.IE%2010%20and%20jQuery%201.x.PNG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-65-12/6011.IE-10-and-jQuery-1.x.PNG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/65/12/6011.IE%2010%20and%20jQuery%201.x.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-65-12/6011.IE-10-and-jQuery-1.x.PNG" alt="" width="747" height="294" border="0" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Changing IIS Authentication Settings of a Classic Mode Web Application in SharePoint 2010 using PowerShell</title>
      <link>https://docs.microsoft.com/archive/blogs/manish_ahuja/changing-iis-authentication-settings-of-a-classic-mode-web-application-in-sharepoint-2010-using-powershell</link>
      <pubDate>Thu, 11 Oct 2012 04:52:00 GMT</pubDate>
      <dc:creator><![CDATA[maahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/manish_ahuja/2012/10/11/changing-iis-authentication-settings-of-a-classic-mode-web-application-in-sharepoint-2010-using-powershell/</guid>
      <description><![CDATA[Will keep this short and simple, so using SharePoint 2010 Management Shell:
1.&nbsp; First get a...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: small;" size="3">Will keep this short and simple, so using SharePoint 2010 Management Shell:</span></p>
<p><span style="font-size: small;" size="3">1.</span>&nbsp; <span style="font-size: small;" size="3">First get a reference to your web application, using following command</span></p>
<p><strong><em><span style="font-size: small;" size="3">$webApp = Get-SPWebApplication &ndash; Identity &lt;URL of your web application&gt;</span></em></strong></p>
<p><span style="font-size: small;" size="3">2.</span>&nbsp; <span style="font-size: small;" size="3">Get the list of zones present in the web application, using following command</span></p>
<p><strong><em><span style="font-size: small;" size="3">$webApp.IisSettings.Keys</span></em></strong></p>
<p><span style="font-size: small;" size="3">Previous command should have shown you names of all the zones in your web application, in our case we saw only one zone called &ldquo;Default&rdquo;. </span></p>
<p><span style="font-size: small;" size="3">If you investigate the members of &ldquo;$webApp.IisSettings("Default")&rdquo;, you will see following</span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/65/12/1541.Blog1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-65-12/1541.Blog1.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/65/12/1541.Blog1.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-65-12/1541.Blog1.png" border="0" /></a><span style="font-family: Times New Roman; font-size: small;" size="3" face="Times New Roman"> </span></p>
<p><span style="font-family: Times New Roman; font-size: small;" size="3" face="Times New Roman">&nbsp;<span style="font-family: Times New Roman; font-size: small;" size="3" face="Times New Roman"> </span></span></p>
<p><span style="font-size: small;" size="3">3.</span>&nbsp; <span style="font-size: small;" size="3">In this case&nbsp;I&nbsp;had to enable Kerberos on this web application, so will use following commands:</span></p>
<p><em><strong><span style="font-size: small;" size="3">$webApp.IisSettings.Item("Default").DisableKerberos = $false</span></strong></em></p>
<p><em><strong><span style="font-size: small;" size="3">$webApp.Update()</span></strong></em></p>
<p></p>
<p><span style="font-size: small;" size="3">That&rsquo;s it and you are done changing IIS authentication settings for the web application!</span><span style="font-family: Times New Roman; font-size: small;" size="3" face="Times New Roman"><span style="font-family: Times New Roman; font-size: small;" size="3" face="Times New Roman">&nbsp;</span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>How to Create SharePoint ReadOnly Site Columns?</title>
      <link>https://docs.microsoft.com/archive/blogs/manish_ahuja/how-to-create-sharepoint-readonly-site-columns</link>
      <pubDate>Mon, 02 Nov 2009 13:25:00 GMT</pubDate>
      <dc:creator><![CDATA[Manish Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/manish_ahuja/2009/11/02/how-to-create-sharepoint-readonly-site-columns/</guid>
      <description><![CDATA[In this post I will show how to create a SharePoint readonly site column with following...]]></description>
      <content:encoded><![CDATA[<P>In this post I will show how to create a SharePoint readonly site column with following characteristics:</P>
<OL>
<LI>Site column when added to a list or library should not be editable through UI (even datasheet view)</LI>
<LI>Users should be able to add list columns based on&nbsp;site column&nbsp;to personal or shared list views of that list</LI>
<LI>Users should not be able to modify any settings of the list column based on this site column (depends on field type and priviliges).</LI>
<LI>Any updates to list column values&nbsp;can only be done programmatically</LI></OL>
<P>Long story short, I&nbsp;noticed that InfoPath promoted properties which are not editable have all these characteristics. So, I&nbsp;created site column defintion similar to one that is generated automatically for site columns based on an InfoPath form's readonly promoted property. </P>
<P>Here is a sample readonly site column definition:</P><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>&lt;</FONT></FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>Field</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2>ID</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>{102ED08D-CE13-4f56-B07E-7B5118191949}</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2>Type</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Text</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2>Name</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>ReadonlyTest1</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2>DisplayName</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Read Only Test 1</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2>StaticName</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>ReadonlyTest1</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2>Group</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Test Columns</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>Hidden</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>FALSE</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>ReadOnly</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>TRUE</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>Required</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>FALSE</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> <FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>ShowInDisplayForm</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT color=#000000 size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>TRUE</FONT></FONT><FONT color=#000000 size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>ShowInViewForms</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT color=#000000 size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>TRUE</FONT></FONT><FONT size=2><FONT color=#000000>" </FONT></FONT></FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>PITarget</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>""</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>PrimaryPITarget</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>""</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>PIAttribute</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>""</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>PrimaryPIAttribute</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>""</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>Node</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>""</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>/&gt;</P></FONT></FONT>
<P mce_keep="true">Essentially, add these attributes to any site column definition to make&nbsp;it readonly:</P>
<P mce_keep="true"><STRONG><FONT color=#ff0000>Hidden</FONT></STRONG><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>FALSE</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>ReadOnly</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>TRUE</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>Required</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>FALSE</FONT></FONT><FONT size=2>"</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>PITarget</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>""</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>PrimaryPITarget</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>""</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>PIAttribute</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>""</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>PrimaryPIAttribute</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>""</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </FONT></FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2><STRONG>Node</STRONG></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>=</FONT></FONT><FONT size=2>""</FONT></P>
<P mce_keep="true">Following is a sample code to modify the value of list column based on above sample site column when it's&nbsp;added to a custom&nbsp;list called <STRONG>"Test":</STRONG></P><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>using</FONT></FONT><FONT size=2> (</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>SPSite</FONT></FONT><FONT size=2> site = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>SPSite</FONT></FONT><FONT size=2>(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"https://&lt;your site&gt;/"</FONT></FONT><FONT size=2>))</P>
<P>{</P>
<BLOCKQUOTE>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>using</FONT></FONT><FONT size=2> (</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>SPWeb</FONT></FONT><FONT size=2> web = site.RootWeb)</P></BLOCKQUOTE>
<BLOCKQUOTE>
<P>{</P>
<BLOCKQUOTE>
<P></FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>SPList</FONT></FONT><FONT size=2> oList = web.Lists[</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"Test"</FONT></FONT><FONT size=2>];</P>
<P></FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>SPListItem</FONT></FONT><FONT size=2> oListItem = oList.Items[0];</P>
<P>oListItem[</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"Read Only Test 1"</FONT></FONT><FONT size=2>] = </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"Updated Text"</FONT></FONT><FONT size=2>;</P>
<P>oListItem.Update();</P></BLOCKQUOTE>
<P>}</P></BLOCKQUOTE>
<P>}</P></FONT>]]></content:encoded>
    </item>
    <item>
      <title>Creating a SharePoint Site with Anonymous Viewers and Contributors</title>
      <link>https://docs.microsoft.com/archive/blogs/manish_ahuja/creating-a-sharepoint-site-with-anonymous-viewers-and-contributors</link>
      <pubDate>Fri, 03 Jul 2009 04:47:55 GMT</pubDate>
      <dc:creator><![CDATA[Manish Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/manish_ahuja/2009/07/03/creating-a-sharepoint-site-with-anonymous-viewers-and-contributors/</guid>
      <description><![CDATA[In this blog entry we will show how to create a SharePoint site such that anonymous users should...]]></description>
      <content:encoded><![CDATA[<p><b></b></p>  <p>In this blog entry we will show how to create a SharePoint site such that <b>anonymous</b> users should be able to <b>contribute</b> content into lists/libraries and also browse the site. </p>  <table style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; border-top: medium none; border-right: medium none; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0"><tbody>     <tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">       <td style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; padding-left: 5.4pt; width: 6.65in; padding-right: 5.4pt; background: #fdeada; border-top: black 1pt solid; border-right: black 1pt solid; padding-top: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-background-themecolor: accent6; mso-background-themetint: 51" valign="top" width="638">         <p style="line-height: normal; margin-bottom: 0pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><u>Warning:</u></b><b style="mso-bidi-font-weight: normal"><u></u></b></p>          <p></p>          <p style="line-height: normal; margin-bottom: 0pt" class="MsoNormal">We will leave out various non-essential configuration details from the perspective of this blog entry; however, these details might be very crucial or important in your scenario.&#160; </p>          <p>&#160;</p>          <p></p>          <p style="line-height: normal; margin-bottom: 0pt" class="MsoNormal">For example settings like name of web application, port number and host entries etc.<span style="color: red"> </span>            <p>&#160;</p>         </p>          <p></p>       </td>     </tr>   </tbody></table>  <p>To do so follow the steps shown below:</p>  <p><b>Step 1. </b>Create a new or extend an existing web application with settings:</p>  <p><i></i></p>  <p><i>Central Administration &gt; Application Management &gt; Create or Extend Web Application &gt; Create New Web Application&gt; Security Configuration &gt; Allow Anonymous = Yes </i></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image002%5B5%5D.jpg" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image002%5B5%5D.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002[5]" border="0" alt="clip_image002[5]" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image002%5B5%5D_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image002%5B5%5D_thumb.jpg" width="534" height="161" /></a></p>  <p>Figure 1 – New Web Application Security Configuration </p>  <p>&#160;</p>  <table style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; border-top: medium none; border-right: medium none; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0"><tbody>     <tr style="height: 40.5pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">       <td style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; padding-left: 5.4pt; width: 473.4pt; padding-right: 5.4pt; background: #ebf1de; height: 40.5pt; border-top: black 1pt solid; border-right: black 1pt solid; padding-top: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-background-themecolor: accent3; mso-background-themetint: 51" valign="top" width="631">         <p style="line-height: normal; margin-bottom: 0pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><u>Note:</u></b></p>          <p style="text-align: justify; line-height: normal; margin-bottom: 0pt" class="MsoNormal">This is required because in the world of IIS 6.0 or 7.0, web application is the boundary for authentication type. </p>          <p></p>          <p></p>          <p style="line-height: normal; margin-bottom: 0pt" class="MsoNormal"></p>          <p>&#160;</p>          <p></p>       </td>     </tr>   </tbody></table>  <p>You can also edit this setting for an existing web application through: </p>  <p><i>Central Administration &gt; Application Management &gt; Authentication Providers &gt; Edit Authentication &gt; Anonymous Access &gt; Enable anonymous access = True</i></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image004%5B4%5D.jpg" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image004%5B4%5D.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004[4]" border="0" alt="clip_image004[4]" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image004%5B4%5D_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image004%5B4%5D_thumb.jpg" width="613" height="299" /></a></p>  <p>Figure 2 - Existing Web Application Security Configuration </p>  <table style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; border-top: medium none; border-right: medium none; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0"><tbody>     <tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">       <td style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; padding-left: 5.4pt; width: 6.65in; padding-right: 5.4pt; background: #fdeada; border-top: black 1pt solid; border-right: black 1pt solid; padding-top: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-background-themecolor: accent6; mso-background-themetint: 51" valign="top" width="638">         <p style="line-height: normal; margin-bottom: 0pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><u>Note:</u></b></p>          <p style="line-height: normal; margin-bottom: 0pt" class="MsoNormal">Office Client Integration doesn’t work very well with Anonymous access, so it’s a good idea that we keep it disabled.<span style="color: red"> </span>            <p>&#160;</p>         </p>          <p></p>          <p style="line-height: normal; margin-bottom: 0pt" class="MsoNormal">For example, Actions like <i style="mso-bidi-font-style: normal">Export to Spreadsheet</i>, <i style="mso-bidi-font-style: normal">Open with Access</i> etc. will not work. In other cases when you try to open word and excel documents/sheets you will prompted with user name and password dialog box. </p>          <p></p>          <p></p>          <p style="line-height: normal; margin-bottom: 0pt" class="MsoNormal"><span style="color: red"></span>            <p>&#160;</p>         </p>          <p></p>       </td>     </tr>   </tbody></table>  <p><b></b></p>  <p><b>Step 2. </b>Create your site collection in the web application that was created or modified in Step 1.</p>  <p><b></b></p>  <p><b>Step 3. </b>Enable the anonymous access to this site collection, go to </p>  <p><i></i></p>  <p><i>Site Settings &gt; Advanced permissions (</i>https://&lt;your site collection&gt;/_layouts/user.aspx<i>)</i></p>  <p><i></i></p>  <p>Click on<i> Settings &gt; Anonymous Access</i></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image006%5B4%5D.jpg" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image006%5B4%5D.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image006[4]" border="0" alt="clip_image006[4]" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image006%5B4%5D_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image006%5B4%5D_thumb.jpg" width="244" height="152" /></a></p>  <p>Figure 3 - Site Collection Anonymous Access</p>  <p>And then enable anonymous access for site collection:</p>  <p><i>Anonymous Access &gt; Anonymous users can access = Entire Web Site</i></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image008%5B4%5D.jpg" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image008%5B4%5D.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image008[4]" border="0" alt="clip_image008[4]" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image008%5B4%5D_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image008%5B4%5D_thumb.jpg" width="635" height="130" /></a></p>  <p>Figure 4 - Enable Anonymous Access for Web Site</p>  <p><b></b></p>  <p><b>Step 4. </b>Enable the anonymous access on lists and document libraries that you want anonymous users to view, edit etc.</p>  <blockquote>   <p>Following is an excerpt from TechNet article that can be found <a href="https://technet.microsoft.com/en-us/library/cc263363.aspx">here</a>:</p>    <p>1. Go to the home page of your Web site and, in the left navigation pane, click View All Site Content.</p>    <p>2. Click the list on which you want to enable anonymous access.</p>    <p>3. On the Settings menu, click List Settings.</p>    <p>4. On the Customize List page, in the Permissions and Management section, click Permissions for this list.</p>    <p>5. On the Permissions page, on the Actions menu, click Edit Permissions. A dialog box is displayed informing you that you are about to create unique permissions for this list. Click OK.</p>    <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image009%5B4%5D.png" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image009%5B4%5D.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image009[4]" border="0" alt="clip_image009[4]" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image009%5B4%5D_thumb.png" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image009%5B4%5D_thumb.png" width="244" height="179" /></a></p>    <p>Figure 5 - Edit List / Document Library Permissions</p>    <p>6. On the Settings menu, click Anonymous Access.</p>    <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image011%5B4%5D.jpg" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image011%5B4%5D.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image011[4]" border="0" alt="clip_image011[4]" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image011%5B4%5D_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image011%5B4%5D_thumb.jpg" width="244" height="167" /></a></p>    <p>Figure 6 - List/Library Anonymous Access</p>    <p>Select permissions for users who have anonymous access to the list, and then click OK.</p>    <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image012_2.png" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image012_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image012" border="0" alt="clip_image012" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image012_thumb.png" original-url="https://blogs.msdn.com/blogfiles/manish_ahuja/WindowsLiveWriter/CreatingaSharePointSitewithAnonymousView_C8E5/clip_image012_thumb.png" width="642" height="209" /></a></p>    <p>Figure 7 - List/Library Anonymous Access Permissions </p> </blockquote>  <p>&#160;</p>  <table style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; border-top: medium none; border-right: medium none; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0"><tbody>     <tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">       <td style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; padding-left: 5.4pt; width: 6.65in; padding-right: 5.4pt; background: #ebf1de; border-top: black 1pt solid; border-right: black 1pt solid; padding-top: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-background-themecolor: accent3; mso-background-themetint: 51" valign="top" width="638">         <p><b style="mso-bidi-font-weight: normal"><u><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-theme-font: minor-bidi">Recommendations: </span>                <p></p>             </u></b></p>          <p></p>          <p style="text-indent: -0.25in; margin-left: 0.5in; mso-list: l0 level1 lfo1"><b style="mso-bidi-font-weight: normal"><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: ignore">1.<span style="font: 7pt &quot;Times New Roman&quot;">&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span></b><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-theme-font: minor-bidi">Extend an existing web application with Windows or Forms based authentication to a zone with anonymous access only (all other authentication mechanism are normally disabled). This zone is what anonymous users should use. </span>            <p></p>         </p>          <p></p>          <p style="text-indent: -0.25in; margin-left: 0.5in; mso-list: l0 level1 lfo1"><b style="mso-bidi-font-weight: normal"><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: ignore">2.<span style="font: 7pt &quot;Times New Roman&quot;">&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span></b><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-theme-font: minor-bidi">Use the original zone (with Windows or Forms based authentication) to add content or configure the site. <span style="mso-spacerun: yes">&#160;</span>Since, any changes to the site with anonymous access can only be done when you are authenticated. </span>            <p></p>         </p>          <p></p>       </td>     </tr>   </tbody></table>]]></content:encoded>
    </item>
    <item>
      <title>Customizing Contact Selector Control for Single Contact Selection</title>
      <link>https://docs.microsoft.com/archive/blogs/manish_ahuja/customizing-contact-selector-control-for-single-contact-selection</link>
      <pubDate>Sat, 05 May 2007 12:46:00 GMT</pubDate>
      <dc:creator><![CDATA[Manish Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/manish_ahuja/2007/05/05/customizing-contact-selector-control-for-single-contact-selection/</guid>
      <description><![CDATA[More often than not, while&nbsp;developing custom workflow LOB (Line of Business)&nbsp;applications,...]]></description>
      <content:encoded><![CDATA[<P>More often than not, while&nbsp;developing custom workflow LOB (Line of Business)&nbsp;applications, we come across situations where we need to develop an application&nbsp;feature to provide end users capability to select other users or contacts for assignment of tasks, as participants of workflow, etc. from AD (Active Directory) or User Profiles in SharePoint.</P>
<P>In case of InfoPath 2007 browser enabled forms, there is a very handy ActiveX control available OOB, to find more about it, read following article from InfoPath Team :</P>
<P><A id=bp___v___r___postlist___EntryItems_ctl12_PostTitle href="https://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx" mce_href="https://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx"><FONT color=#4271d6>Using the Contact Selector Control</FONT></A></P>
<P>Now, just in case like me, if you&nbsp;find above control inept in certain scenarios where you&nbsp;wish to make sure that only&nbsp;single&nbsp;contact is selected by end user from AD or User Profile. </P>
<P>And, if you find writing code for custom UI that fetches and displays&nbsp;users from AD or User Profiles in SharePoint Server, is too much a task and you need some sort of workaround for this issue and still be able to use the contact selector control. Then, try adding following code to Contact Selector control's (named gpContactSelector here)&nbsp;Changed Event:</P>
<P mce_keep="true">&nbsp;</P>
<DIV style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 8pt; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; HEIGHT: 231px; BACKGROUND-COLOR: #f4f4f4"><PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #0000ff">void</SPAN> gpContactSelector_Changed(<SPAN style="COLOR: #0000ff">object</SPAN> sender, XmlEventArgs e)
{
  <SPAN style="COLOR: #0000ff">string</SPAN> senderLocalName = ((XPathNavigator)sender).LocalName;

  <SPAN style="COLOR: #0000ff">if</SPAN> ( senderLocalName == <SPAN style="COLOR: #006080">"DisplayName"</SPAN>)
  {
      XPathNavigator navigator = MainDataSource.CreateNavigator().SelectSingleNode(<SPAN style="COLOR: #006080">"/my:myFields/my:gpContactSelector"</SPAN>, NamespaceManager);
      <SPAN style="COLOR: #0000ff">if</SPAN> (navigator != <SPAN style="COLOR: #0000ff">null</SPAN>)
      {
          <SPAN style="COLOR: #0000ff">int</SPAN> count = navigator.SelectChildren(XPathNodeType.Element).Count;
          <SPAN style="COLOR: #0000ff">if</SPAN> (count &gt; 1)
          {
              <SPAN style="COLOR: #0000ff">this</SPAN>.Errors.Add(navigator, <SPAN style="COLOR: #006080">"InvalidUserCount"</SPAN>, <SPAN style="COLOR: #006080">"Can't select multiple users."</SPAN>);
          }
      }
  }
  <SPAN style="COLOR: #0000ff">else</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> (senderLocalName == <SPAN style="COLOR: #006080">"Person"</SPAN>)
  {
      XPathNavigator navigator = MainDataSource.CreateNavigator().SelectSingleNode(<SPAN style="COLOR: #006080">"/my:myFields/my:gpContactSelector"</SPAN>, NamespaceManager);
      <SPAN style="COLOR: #0000ff">if</SPAN> (navigator != <SPAN style="COLOR: #0000ff">null</SPAN>)
      {
          <SPAN style="COLOR: #0000ff">int</SPAN> count = navigator.SelectChildren(XPathNodeType.Element).Count;
          <SPAN style="COLOR: #0000ff">if</SPAN> (count == 1)
          {
              <SPAN style="COLOR: #0000ff">if</SPAN> (Errors.Count &gt;= 1)
              {
                  <SPAN style="COLOR: #0000ff">try</SPAN>
                  {
                      <SPAN style="COLOR: #0000ff">this</SPAN>.Errors.Delete(<SPAN style="COLOR: #006080">"InvalidUserCount"</SPAN>);
                  }
                  <SPAN style="COLOR: #0000ff">catch</SPAN> (ArgumentException)
                  {
                       <SPAN style="COLOR: #008000">// Do nothing</SPAN>
                  }
                  <SPAN style="COLOR: #0000ff">catch</SPAN> (Exception)
                  {
                      <SPAN style="COLOR: #0000ff">throw</SPAN>;
                  }
              }
          }
      }
  }
}</PRE></DIV>
<P mce_keep="true">&nbsp;</P>
<P>The code snippet shown above&nbsp;will add an error object in form's error collection whenever an end user selects more than one contact.&nbsp;This&nbsp;should&nbsp;make sure that user is not allowed to submit the form, unless, the error is resolved by&nbsp;end user manually, i.e.&nbsp;by removing&nbsp;all the selected&nbsp;contacts save one from the Contact Selector control in the UI.&nbsp;</P>
<P>We can also automate this removal of extra contacts in code behind, and then warn end users by adding an error object in the forms error collection or by displaying a message in UI. </P>
<P>However, do make sure that&nbsp;your customer is aware of this scenario and is okay with this. Otherwise, you&nbsp;may find a bunch of confused end users, trying to figure out, what is happening to all those contacts they selected.</P>
<P>Catch in this approach is,&nbsp;end users are&nbsp;not warned until they have selected a bunch of contacts.&nbsp;If this becomes a major usability issue and your customer is not ready to buy in, then, IMHO only choice&nbsp;is creating&nbsp;a custom UI for contact selection.</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
  </channel>
</rss>