<?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>Chun Liu on SharePoint</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/chunliu/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/chunliu/feed.xml</link>
    <description>my thought</description>
    <lastBuildDate>Tue, 16 Apr 2019 04:53:41 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Configuring SharePoint 2013 to Use Office Web Apps</title>
      <link>https://docs.microsoft.com/archive/blogs/chunliu/configuring-sharepoint-2013-to-use-office-web-apps</link>
      <pubDate>Fri, 21 Dec 2012 06:53:55 GMT</pubDate>
      <dc:creator><![CDATA[Chun Liu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chunliu/2012/12/21/configuring-sharepoint-2013-to-use-office-web-apps/</guid>
      <description><![CDATA[To configure SharePoint 2013 to use Office Web Apps, there are two essential references.      Deploy...]]></description>
      <content:encoded><![CDATA[<p>To configure SharePoint 2013 to use Office Web Apps, there are two essential references. </p>  <ol>   <li>Deploy Office Web Apps Server (<a title="https://technet.microsoft.com/en-us/library/jj219455(v=office.15).aspx" href="https://technet.microsoft.com/en-us/library/jj219455(v=office.15).aspx">https://technet.microsoft.com/en-us/library/jj219455(v=office.15).aspx</a>)</li>    <li>Configure SharePoint 2013 to use Office Web Apps (<a title="https://technet.microsoft.com/en-us/library/ff431687(v=office.15).aspx" href="https://technet.microsoft.com/en-us/library/ff431687(v=office.15).aspx">https://technet.microsoft.com/en-us/library/ff431687(v=office.15).aspx</a>)</li> </ol>  <p>According to them, the configuration looks like very straight forward. However, the devil is in the details. Here, I am trying to list some issues that I experienced recently with the RTM version of SharePoint 2013 and Office Web Apps so I don’t forget them soon. </p>  <p><strong>1. .NET Framework 3.5</strong></p>  <p>When you install Office Web Apps on Windows Server 2012, you usually run the PowerShell script in the above articles to prepare the roles and features of Windows. That script doesn’t install .NET Framework 3.5 Core. However, at some points it looks like the Office Web Apps still needs the .NET Framework 3.5 Core. Without it, you may see the event error below. </p>  <blockquote>   <p><font color="#0000ff">Server Error in ‘/m’ Application</font></p>    <p><font color="#0000ff">Warning: ASP.NET 4.0 – Event code: 3008 – Event ID: 1310</font></p>    <p><font color="#0000ff">Could not load file or assembly ‘Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified. (C:\Program Files\Microsoft Office Web Apps\BroadcastServices_Host\web.config line 44)</font></p> </blockquote>  <p>To avoid it, you can add the .NET Framework 3.5 Core feature, or run the following PowerShell script: </p>  <p><font color="#c0504d">Add-WindowsFeature NET-Framework-Features, NET-Framework-Core</font></p>  <p>The only thing to notice is that Windows Server 2012 wasn’t shipped with .NET Framework 3.5. So you must have an Internet connection on the server so the core can be added successfully with the above method. </p>  <p><strong>2. Office Web Apps Host</strong></p>  <p>In case Office Web Apps don’t work after you finish the configuration and verified everything including the WOPI zone, you have to check the error log of the Office Web Apps. The default location of the log is C:\ProgramData\Microsoft\OfficeWebApps\Data\Logs\ULS. </p>  <p>At some points, if you see the following error: </p>  <p><font color="#0000ff">WOPI - CreateWopiHttpRequest failing due to invalid host</font></p>  <p>It means the domain name or the host name of the SharePoint site is not trusted by Office Web Apps. You have to use the following PowerShell script to add the name into the host list. </p>  <p><font color="#c0504d">New-OfficeWebAppsHost -Domain &lt;String&gt;</font> </p>  <p>The name of the parameter may lead to some confusing. You may think it is the name of the domain which your SharePoint server belongs to, but it is not. For example, the name of your domain may be contoso.com, but the url of the SharePoint site may be <a href="https://sharepoint">https://sharepoint</a>. In this case, you should put “sharepoint” instead of “contoso.com”. </p>  <p>Based on my testing, when configuring Office Web Apps over HTTP, you have to configure the host list. When configuring over HTTPS, the host list can be empty. </p>  <p><strong>3. AllowOAuthOverHttp</strong></p>  <p>Again, the TechNet article may lead to some misunderstanding to this option. According to the article, it looks like this option should be True when Office Web Apps are configured to use HTTP, and False when they are configured to use HTTPS. However, it is not true based on my testing. This option is more like depending on the configuration of the SharePoint site. If the SharePoint site is using HTTP, this option should be True no matter if HTTP or HTTPS is used by Office Web Apps. </p>  <p>If you see the “<font color="#0000ff">HTTPResponseCode forbidden</font>” error in the Office Web Apps log, in most of case it is because of the incorrect setting of this option. </p>  <p><strong>4. Word Doc Corrupted</strong></p>  <p>At some points, you may see the following error in the Office Web Apps log. </p>  <p><font color="#0000ff">[AppServerHost.exe] Word failed to open the document (Error Code = 0x80040266)</font></p>  <p>It is very like the Word document you are trying to open with Office Web Apps has been corrupted. You can upload a good document to test and confirm it. </p>  <p>One scenarios which may create such a corrupted Word doc is that you choose to create a new Word doc in SharePoint site with Office Web Apps. However, for some reason Office Web Apps don’t work normally. In this case, you get a corrupted Word doc in SharePoint document library. </p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint 2013 goes to public</title>
      <link>https://docs.microsoft.com/archive/blogs/chunliu/sharepoint-2013-goes-to-public</link>
      <pubDate>Mon, 16 Jul 2012 18:08:27 GMT</pubDate>
      <dc:creator><![CDATA[Chun Liu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chunliu/2012/07/16/sharepoint-2013-goes-to-public/</guid>
      <description><![CDATA[With the announcement here, Office 2013 and SharePoint 2013 goes to public today. As an early beta...]]></description>
      <content:encoded><![CDATA[<p>With the announcement <a href="https://www.microsoft.com/en-us/news/Press/2012/Jul12/07-16OfficePR.aspx" target="_blank">here</a>, Office 2013 and SharePoint 2013 goes to public today. As an early beta participant, I can tell you that there are a lot of changes and new features in the new version and everyone who is working on Office and SharePoint should give it a try. </p>  <p>Here is a good start point: <a href="https://technet.microsoft.com/en-us/sharepoint/fp142366" target="_blank">SharePoint 2013 for IT pros</a></p>]]></content:encoded>
    </item>
    <item>
      <title>The flowchart of the IE rendering modes</title>
      <link>https://docs.microsoft.com/archive/blogs/chunliu/the-flowchart-of-the-ie-rendering-modes</link>
      <pubDate>Thu, 19 Jan 2012 23:12:58 GMT</pubDate>
      <dc:creator><![CDATA[Chun Liu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chunliu/2012/01/19/the-flowchart-of-the-ie-rendering-modes/</guid>
      <description><![CDATA[Several folks asked me about the flowchart of the IE rendering modes that I showed in one of my...]]></description>
      <content:encoded><![CDATA[<p>Several folks asked me about the flowchart of the IE rendering modes that I showed in one of my sessions on GeekReady Asia. I share it here so it is easier for everyone to find it. The flowchart was created by <a href="https://hsivonen.iki.fi/author/">Henri Sivonen</a>. He shared the flowchart in his great article: <a href="https://hsivonen.iki.fi/doctype/" target="_blank">Activating Browser Modes with Doctype</a>. In this article, he explained how browsers, not only IE but also other major browsers, chose the rendering modes according to the Doctype. Thanks to his excellent work. </p>  <p><a href="https://hsivonen.iki.fi/doctype/ie8-mode.png" target="_blank"><img src="https://hsivonen.iki.fi/doctype/ie8-mode.png" width="533" height="445" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Auto Update Statistics and Auto Create Statistics – ON or OFF for SharePoint 2010 Databases?</title>
      <link>https://docs.microsoft.com/archive/blogs/chunliu/auto-update-statistics-and-auto-create-statistics-on-or-off-for-sharepoint-2010-databases</link>
      <pubDate>Thu, 17 Nov 2011 06:35:00 GMT</pubDate>
      <dc:creator><![CDATA[Chun Liu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chunliu/2011/11/17/auto-update-statistics-and-auto-create-statistics-on-or-off-for-sharepoint-2010-databases/</guid>
      <description><![CDATA[Update: CTS complained that some customers turned ON auto-create statistics on content databases...]]></description>
      <content:encoded><![CDATA[<p><em><strong>Update</strong>: CTS complained that some customers turned ON auto-create statistics on content databases because of this post. If you think you should turn on this option on content databases&nbsp;after reading this post, please let me know by leaving a comment below. The key message in this post is, in most of cases you don't need to change the default settings of these two options on SharePoint databases. In the extreme case where you have to change them, contact CTS for support first.</em></p>
<p>If you ask any SQL DBA a question like, &ldquo;should I turn on Auto Update Statistics and Auto Create Statistics on databases?&rdquo; You&rsquo;ll get an answer like, &ldquo;Yes, definitely!&rdquo; or probably &ldquo;<a href="https://www.sqlskills.com/blogs/kimberly/post/Auto-update-statistics-and-auto-create-statistics-should-you-leave-them-on-andor-turn-them-on.aspx">It depends</a>&rdquo;. But if we are talking about SharePoint 2010 databases, the answer is &ldquo;It really depends&rdquo;.</p>
<p>In the <a href="https://technet.microsoft.com/en-us/library/cc298801.aspx#Section6">official document</a>, it suggests to turn off these options and explains why they should be turned off. But what it didn&rsquo;t tell is how SharePoint will maintain the statistics if the options are turned off. Therefore, it could lead to some confusions like should we turn them off on all databases or just on some databases? should we manually maintain the statistics if we turn them off? etc.</p>
<p>So let me try to explain how SharePoint maintains the statistics first.</p>
<p><strong><em>Health Analyzer Rule: Databases used by SharePoint have outdated index statistics</em></strong></p>
<p>As explained in this <a href="https://technet.microsoft.com/en-us/library/cc262731.aspx#DBMaintenanceForSPS2010_ReducingFragForDB">whitepaper</a>, SharePoint uses this Health Analyzer rule to maintain the statistics (unfortunately the whitepaper didn&rsquo;t mention the name of this rule). By default, this rule is scheduled to run everyday and it is a repairable rule, meaning it has a repair action. What this rule does is very simple. It will enumerate all SharePoint databases in the farm and check if the database implements a store procedure, proc_UpdateStatistics. If so, it will call this store procedure directly. Otherwise, it will do nothing.&nbsp;</p>
<p>So now the problem become simple. To find out on which databases we should turn on the options and on which we should turn them off, we just need to check if the database implements the store procedure. If it implements the store procedure, means it has its own way to maintain the statistics and doesn&rsquo;t rely on SQL server. So the options can be turned off. Otherwise, the options should be on.</p>
<p>Based on my checking, the following databases implement the store procedure, and the two options are turned off by default, <strong>meaning SharePoint has its own way to maintain the statistics of these databases.&nbsp;These two options should be left OFF on these databases in most cases.</strong>&nbsp;The list is quite similar to the databases mentioned at the beginning of the above whitepaper. (I hope I&rsquo;ve exhausted the SharePoint dbs.)</p>
<ul>
<li>Configuration databases</li>
<li>Content databases</li>
<li>User Profile Service Application Profile databases</li>
<li>User Profile Service Application Social databases</li>
<li>Web Analytics Service Application Reporting databases</li>
<li>Web Analytics Service Application Staging databases</li>
<li>Word Automation Services databases</li>
<li>WSS_Logging</li>
</ul>
<p>The only exception is the crawl db of the SharePoint search service. It implements the store procedure but the two options are turn on as well. I am not sure if it was intended to be set like that or what.</p>
<p>So let us go back to our original question, should we turn on or off the two options on a SharePoint 2010 database? My answer would be it depends on which database you are talking about. If the database knows how to maintain its own statistics, the options should be turned off and SharePoint will take care of it. Otherwise, the options should be turned on.</p>]]></content:encoded>
    </item>
    <item>
      <title>How My Site Cleanup Job works</title>
      <link>https://docs.microsoft.com/archive/blogs/chunliu/how-my-site-cleanup-job-works</link>
      <pubDate>Thu, 10 Nov 2011 00:42:36 GMT</pubDate>
      <dc:creator><![CDATA[Chun Liu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chunliu/2011/11/10/how-my-site-cleanup-job-works/</guid>
      <description><![CDATA[The following is a flowchart I drew according to the implementation of this time job.   ]]></description>
      <content:encoded><![CDATA[<p>The following is a flowchart I drew according to the implementation of this time job. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/1513.mysitecleanupjob_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-36-23-metablogapi/1513.mysitecleanupjob_5F00_2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="mysitecleanupjob" border="0" alt="mysitecleanupjob" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/4743.mysitecleanupjob_thumb.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-36-23-metablogapi/4743.mysitecleanupjob_5F00_thumb.png" width="370" height="542" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Details about how Document ID Service is activated</title>
      <link>https://docs.microsoft.com/archive/blogs/chunliu/details-about-how-document-id-service-is-activated</link>
      <pubDate>Wed, 27 Jul 2011 01:39:05 GMT</pubDate>
      <dc:creator><![CDATA[Chun Liu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chunliu/2011/07/27/details-about-how-document-id-service-is-activated/</guid>
      <description><![CDATA[You may have found that Document ID Service is a very interesting feature. Sometimes you activate it...]]></description>
      <content:encoded><![CDATA[<p>You may have found that Document ID Service is a very interesting feature. Sometimes you activate it and it just works as expected. But sometimes you activate it and it doesn’t work immediately. A typical example is to activate it on a team site and a publishing portal site. On the team site, it works immediately, but on the publishing portal site, it doesn’t work immediately. So what is the reason behind? </p>  <p>The reason why this feature works like that is related to how it is activated. Basically, when we activate this feature, it will check if the current site collection is a big site or not. If the site collection is not big, it will just enable the DocId on the site collection and register a work item for the Document ID Assignment timer job (DocIdAssignment). But if the site collection is too big, it will just register a DocIdEnableWorkItem for the Document ID Enable/Disable timer job (DocIdEnable). So to big site, it relies on the DocIdEnable timer job to enable the DocId. But you may find even if you run this timer job immediately after the feature is activated, the DocId is not enabled. It is because when the DocIdEnableWorkItem is added to the site by the feature activation, it has been specified to be executed 30 minutes later to avoid the potential conflict. You can check the real scheduled delivery time by querying ScheduledWorkItems table in the content db. So the DocId will only be enabled when you run DocIdEnable timer job after the scheduled delivery time. For example, suppose you activated DocId feature on a publishing portal at 8:00am, the DocIdEnableWorkItem was scheduled to be delivered at 8:30am. If you ran DocIdEnable timer job before 8:30am, nothing really happened. Only when you ran it after 8:30am say 8:35am, DocId was enabled then.</p>  <p>The final question is how big a site collection is big? The boundaries are maximum 1 web/site, 40 lists/web and 20 doclibs/web. A publishing portal is too big because by default it has 3 webs. The OOTB document center is OK because by default it has 1 web, ~30 lists and ~15 document libraries. The numbers are hard coded and, so far as I know, there is no way to change them.&#160; </p>]]></content:encoded>
    </item>
    <item>
      <title>Interesting Facts About Patching of SharePoint 2010</title>
      <link>https://docs.microsoft.com/archive/blogs/chunliu/interesting-facts-about-patching-of-sharepoint-2010</link>
      <pubDate>Thu, 30 Jun 2011 07:01:00 GMT</pubDate>
      <dc:creator><![CDATA[Chun Liu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chunliu/2011/06/30/interesting-facts-about-patching-of-sharepoint-2010/</guid>
      <description><![CDATA[With the release of the SharePoint 2010 SP1, we had an interesting discussion about the way we...]]></description>
      <content:encoded><![CDATA[<p>With the release of the <a href="https://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=984">SharePoint 2010 SP1</a>, we had an interesting discussion about the way we should follow to patch SharePoint 2010. And I just learned several things that I didn&rsquo;t exactly know before. Let me just share them here.</p>
<p>According to the SharePoint team blog, SP1 should be installed in the following order:</p>
<blockquote>
<p><em>1. </em><a href="https://www.microsoft.com/download/en/details.aspx?id=26640"><em>Service Pack 1 for SharePoint Foundation 2010</em></a></p>
<p><em>2. </em><a href="https://www.microsoft.com/download/en/details.aspx?id=26629"><em>Service Pack 1 for SharePoint Foundation 2010 Language Pack (if applicable)</em></a></p>
<p><em>3. </em><a href="https://www.microsoft.com/downloads/details.aspx?FamilyId=B9FCDC42-EEA4-4C08-9169-A9A73E55B8D4"><em>Service Pack 1 for SharePoint Server 2010 </em></a></p>
<p><em>4. </em><a href="https://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=26621"><em>Service Pack 1 for SharePoint Server 2010 Language Pack (if applicable)</em></a></p>
</blockquote>
<p>This align to the best practice published <a href="https://technet.microsoft.com/en-us/sharepoint/ff800847.aspx">here</a>:</p>
<blockquote>
<p><strong><em>Best practice</em></strong></p>
<p><em>We recommend that you always install SharePoint Foundation 2010 patches before you install SharePoint Server 2010 patches. This best practice ensures that you will be successful when installing updates.</em></p>
<p><em>The software update system is designed to be flexible enough to allow you to install updates in any order. However, the only time you should diverge from the best practice is if you have a specific reason to do so (for example, if you are directed to by Microsoft support).</em></p>
</blockquote>
<p>But the fact is that you don&rsquo;t have to install the SP1 for Foundation first. The SP1 for SharePoint Server can be installed directly, because it is a Full (&ldquo;Uber&rdquo;) package. Installing the SP1 for Foundation would just waste your time.</p>
<p>In the same blog, there is another suggestion about June CU:</p>
<blockquote>
<p><em>It is strongly recommended to install the </em><a href="https://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=2536599"><em>June 2011 Cumulative Update </em></a><em>immediately after the installation of Service Pack 1.</em></p>
</blockquote>
<p>If you check the version of June CU, you will find it is 14.0.6106.5000, while the version of SP1 is 14.0.6029.1000. Does that mean June CU has included SP1? The answer is NO. The June CU does not include all of the files included in SP1. That is why you have to install it after the SP1.</p>
<p>Would that be a matter if someone installs the June CU before the SP1? Well, from the information I got, the installation order of the June CU and the SP1 doesn&rsquo;t really matter. You can install the June CU first and then SP1. The files with higher version won&rsquo;t be overwritten, while the missing part in June CU will be installed.</p>
<p><strong>Conclusion?</strong></p>
<p>Well, before patching, verify if the Server patch is a Full package. If so, no need to waste your time patching the Foundation first. Go patching Server directly. If it is not a Full package ( the chance is small but still possible), follow the best practice.</p>
<p>Interesting enough? Check out Jie Li&rsquo;s new post <a href="https://blogs.msdn.com/b/opal/archive/2011/06/30/the-mystery-behind-sharepoint-2010-patching.aspx">The Mystery Behind SharePoint 2010 Patching</a>. I am sure you&rsquo;ll get more fun there.</p>]]></content:encoded>
    </item>
    <item>
      <title>Enabling ECB menu on a custom column in SharePoint 2010 (Part 2)</title>
      <link>https://docs.microsoft.com/archive/blogs/chunliu/enabling-ecb-menu-on-a-custom-column-in-sharepoint-2010-part-2</link>
      <pubDate>Wed, 29 Sep 2010 01:40:00 GMT</pubDate>
      <dc:creator><![CDATA[Chun Liu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chunliu/2010/09/29/enabling-ecb-menu-on-a-custom-column-in-sharepoint-2010-part-2/</guid>
      <description><![CDATA[OK. In Part 1, I’ve explained the problem of “Edit in undefined” when you enable the ECB menu on a...]]></description>
      <content:encoded><![CDATA[<p>OK. In <a href="https://blogs.msdn.com/b/chunliu/archive/2010/09/27/enabling-ecb-menu-on-a-custom-column-in-sharepoint-2010-part-1.aspx" target="_blank">Part 1</a>, I’ve explained the problem of “Edit in undefined” when you enable the ECB menu on a field in the document library. To workaround this problem, we have to go back to the way we used for MOSS. In MOSS, when we want to enable the ECB menu on a field, we have to define a custom field with the Computed field type and add references to two special fields, _EditMenuTableStart and _EditMenuTableEnd. We usually need to add another reference to a field from which the value of the custom field comes. So here in SharePoint 2010, let’s do the same thing. </p>  <p>The following is the definition of my custom field. I’ve highlighted the attributes and values which you may pay attention to. In this field, I want it to have the same value of Title so I add a reference to Title. Note in SharePoint 2010 now we use _EditMenuTableStart2 instead of _EditMenuTableStart. To make things simple, I also create a content type to use this custom field. </p>  <pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot;<span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Elements </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">https://schemas.microsoft.com/sharepoint/</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Field </span><span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">{566F83FF-CCFE-4f7a-BE3C-332169E040B8}</span>&quot;
        <span style="color: red">Group</span><span style="color: blue">=</span>&quot;<span style="color: blue">Morpheus Columns</span>&quot;
        <span style="color: red">ReadOnly</span><span style="color: blue">=</span>&quot;<span style="color: blue">TRUE</span>&quot;
        <font style="background-color: #ffff00"><span style="color: red">Type</span><span style="color: blue">=</span>&quot;<span style="color: blue">Computed</span>&quot;</font>
        <span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">TitleEx</span>&quot;
        <span style="color: red">StaticName</span><span style="color: blue">=</span>&quot;<span style="color: blue">TitleEx</span>&quot;
        <span style="color: red">DisplayName</span><span style="color: blue">=</span>&quot;<span style="color: blue">TitleEx</span>&quot;
        <font style="background-color: #ffff00"><span style="color: red">DisplayNameSrcField</span><span style="color: blue">=</span>&quot;<span style="color: blue">Title</span>&quot;</font>
        <font style="background-color: #ffff00"><span style="color: red">ClassInfo</span><span style="color: blue">=</span>&quot;<span style="color: blue">Menu</span>&quot;</font>
        <font style="background-color: #ffff00"><span style="color: red">AuthoringInfo</span><span style="color: blue">=</span>&quot;<span style="color: blue">(with edit menu)</span>&quot;</font>
        <span style="color: red">SourceID</span><span style="color: blue">=</span>&quot;<span style="color: blue">https://schemas.microsoft.com/sharepoint/v3</span>&quot;<span style="color: blue">&gt;
        <font style="background-color: #ffff00">&lt;</font></span><span style="color: #a31515"><font style="background-color: #ffff00">FieldRefs</font></span><font style="background-color: #ffff00"><span style="color: blue">&gt;
            &lt;</span><span style="color: #a31515">FieldRef </span><span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">{fa564e0f-0c70-4ab9-b863-0177e6ddd247}</span>&quot; 
                      <span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">Title</span>&quot; </font><font style="background-color: #ffff00"><span style="color: blue">/&gt;
            &lt;</span><span style="color: #a31515">FieldRef </span><span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">{1344423c-c7f9-4134-88e4-ad842e2d723c}</span>&quot; 
                      <span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">_EditMenuTableStart2</span>&quot; </font><font style="background-color: #ffff00"><span style="color: blue">/&gt;
            &lt;</span><span style="color: #a31515">FieldRef </span><span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">{2ea78cef-1bf9-4019-960a-02c41636cb47}</span>&quot; 
                      <span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">_EditMenuTableEnd</span>&quot; </font><font style="background-color: #ffff00"><span style="color: blue">/&gt;
        &lt;/</span><span style="color: #a31515">FieldRefs</span></font><span style="color: blue"><font style="background-color: #ffff00">&gt;</font>
        &lt;</span><span style="color: #a31515">DisplayPattern</span><span style="color: blue">&gt;
            &lt;</span><span style="color: #a31515">FieldSwitch</span><span style="color: blue">&gt;
                &lt;</span><span style="color: #a31515">Expr</span><span style="color: blue">&gt;
                    &lt;</span><span style="color: #a31515">GetVar </span><span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">FreeForm</span>&quot;<span style="color: blue">/&gt;
                &lt;/</span><span style="color: #a31515">Expr</span><span style="color: blue">&gt;
                &lt;</span><span style="color: #a31515">Case </span><span style="color: red">Value</span><span style="color: blue">=</span>&quot;<span style="color: blue">TRUE</span>&quot;<span style="color: blue">&gt;
                    &lt;</span><span style="color: #a31515">Field </span><span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">Title</span>&quot;<span style="color: blue">/&gt;
                &lt;/</span><span style="color: #a31515">Case</span><span style="color: blue">&gt;
                &lt;</span><span style="color: #a31515">Default</span><span style="color: blue">&gt;
                    &lt;</span><span style="color: #a31515">Field </span><span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">_EditMenuTableStart2</span>&quot;<span style="color: blue">/&gt;
                    &lt;</span><span style="color: #a31515">Field </span><span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">Title</span>&quot;<span style="color: blue">/&gt;
                    &lt;</span><span style="color: #a31515">Field </span><span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">_EditMenuTableEnd</span>&quot;<span style="color: blue">/&gt;
                &lt;/</span><span style="color: #a31515">Default</span><span style="color: blue">&gt;
            &lt;/</span><span style="color: #a31515">FieldSwitch</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">DisplayPattern</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">Field</span><span style="color: blue">&gt;
  &lt;!-- </span><span style="color: green">Parent ContentType: Document (0x0101) </span><span style="color: blue">--&gt;
  &lt;</span><span style="color: #a31515">ContentType </span><span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">0x010100922fc480f3ae4beba09c8eb3aec9530a</span>&quot;
               <span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">TitleEx</span>&quot;
               <span style="color: red">Group</span><span style="color: blue">=</span>&quot;<span style="color: blue">Morpheus CTypes</span>&quot;
               <span style="color: red">Description</span><span style="color: blue">=</span>&quot;<span style="color: blue">A content type with an ECB menu enabled field. </span>&quot;
               <span style="color: red">Inherits</span><span style="color: blue">=</span>&quot;<span style="color: blue">TRUE</span>&quot;
               <span style="color: red">Version</span><span style="color: blue">=</span>&quot;<span style="color: blue">0</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">FieldRefs</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">FieldRef </span><span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">{fa564e0f-0c70-4ab9-b863-0177e6ddd247}</span>&quot; 
                  <span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">Title</span>&quot; <span style="color: red">Required</span><span style="color: blue">=</span>&quot;<span style="color: blue">TRUE</span>&quot; <span style="color: blue">/&gt;
        &lt;</span><span style="color: #a31515">FieldRef </span><span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">{566F83FF-CCFE-4f7a-BE3C-332169E040B8}</span>&quot; 
                  <span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">TitleEx</span>&quot; <span style="color: red">Required</span><span style="color: blue">=</span>&quot;<span style="color: blue">TRUE</span>&quot; <span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">FieldRefs</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">ContentType</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Elements</span><span style="color: blue">&gt;
</span></pre>

<p>Now if we deploy and use the content type in a document library, my field, TitleEx, is actually displayed as below. There is no value displayed, although there is a value in the Title field. </p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/0257.image_628B21AC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/0257.image_5F00_628B21AC.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/2045.image_thumb_1FCBD674.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/2045.image_5F00_thumb_5F00_1FCBD674.png" width="562" height="94" /></a></p>

<p>The reason why there is nothing in this field is the same as what I mentioned in my <a href="https://blogs.msdn.com/b/chunliu/archive/2010/09/13/rendering-a-field-with-the-custom-xslt-stylesheet.aspx" target="_blank">previous post</a>: SharePoint 2010 now is using XSLT instead of &lt;DisplayPattern&gt; to render the field on the list view. Although I defined &lt;DisplayPattern&gt; for my field, it will never be used. We have to create a custom XSLT to render it. </p>

<p>The following is the XSLT stylesheet I used for my field. </p>

<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot;<span style="color: blue">?&gt;
&lt;</span><span style="color: #2b91af">xsl:stylesheet </span><span style="color: red">xmlns:x</span><span style="color: blue">=</span>&quot;<span style="color: blue">https://www.w3.org/2001/XMLSchema</span>&quot;
                <span style="color: red">xmlns:d</span><span style="color: blue">=</span>&quot;<span style="color: blue">https://schemas.microsoft.com/sharepoint/dsp</span>&quot;
                <span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot;
                <span style="color: red">exclude-result-prefixes</span><span style="color: blue">=</span>&quot;<span style="color: blue">xsl msxsl ddwrt</span>&quot;
                <span style="color: red">xmlns:ddwrt</span><span style="color: blue">=</span>&quot;<span style="color: blue">https://schemas.microsoft.com/WebParts/v2/DataView/runtime</span>&quot;
                <span style="color: red">xmlns:asp</span><span style="color: blue">=</span>&quot;<span style="color: blue">https://schemas.microsoft.com/ASPNET/20</span>&quot;
                <span style="color: red">xmlns:__designer</span><span style="color: blue">=</span>&quot;<span style="color: blue">https://schemas.microsoft.com/WebParts/v2/DataView/designer</span>&quot;
                <span style="color: red">xmlns:xsl</span><span style="color: blue">=</span>&quot;<span style="color: blue">https://www.w3.org/1999/XSL/Transform</span>&quot;
                <span style="color: red">xmlns:msxsl</span><span style="color: blue">=</span>&quot;<span style="color: blue">urn:schemas-microsoft-com:xslt</span>&quot;
                <span style="color: red">xmlns:SharePoint</span><span style="color: blue">=</span>&quot;<span style="color: blue">Microsoft.SharePoint.WebControls</span>&quot;
                <span style="color: red">xmlns:ddwrt2</span><span style="color: blue">=</span>&quot;<span style="color: blue">urn:frontpage:internal</span>&quot;<span style="color: blue">&gt;

    &lt;</span><span style="color: #2b91af">xsl:template </span><span style="color: red">match</span><span style="color: blue">=</span>&quot;<span style="color: blue">FieldRef[@Name='TitleEx']</span>&quot; <span style="color: red">mode</span><span style="color: blue">=</span>&quot;<span style="color: blue">Computed_body</span>&quot;<span style="color: blue">&gt;
        &lt;</span><span style="color: #2b91af">xsl:param </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">thisNode</span>&quot; <span style="color: red">select</span><span style="color: blue">=</span>&quot;<span style="color: blue">.</span>&quot; <span style="color: blue">/&gt;
        &lt;</span><span style="color: #2b91af">xsl:param </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">ShowAccessibleIcon</span>&quot; <span style="color: red">select</span><span style="color: blue">=</span>&quot;<span style="color: blue">0</span>&quot;<span style="color: blue">/&gt;
        &lt;</span><span style="color: #a31515">a </span><span style="color: red">onfocus</span><span style="color: blue">=</span>&quot;<span style="color: blue">OnLink(this)</span>&quot; <span style="color: red">href</span><span style="color: blue">=</span>&quot;<span style="color: blue">{$FORM_DISPLAY}</span><span style="color: red">&amp;amp;</span><span style="color: blue">ID={$thisNode/@ID}</span>&quot; 
           <span style="color: red">onclick</span><span style="color: blue">=</span>&quot;<span style="color: blue">GoToHistoryLink(this, {$thisNode/@_UIVersion});return false;</span>&quot; 
           <span style="color: red">target</span><span style="color: blue">=</span>&quot;<span style="color: blue">_self</span>&quot;<span style="color: blue">&gt;
            &lt;</span><span style="color: #2b91af">xsl:call-template </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">LinkTitleValue</span>&quot;<span style="color: blue">&gt;
                &lt;</span><span style="color: #2b91af">xsl:with-param </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">thisNode</span>&quot; <span style="color: red">select</span><span style="color: blue">=</span>&quot;<span style="color: blue">$thisNode</span>&quot;<span style="color: blue">/&gt;
                &lt;</span><span style="color: #2b91af">xsl:with-param </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">ShowAccessibleIcon</span>&quot; <span style="color: red">select</span><span style="color: blue">=</span>&quot;<span style="color: blue">$ShowAccessibleIcon</span>&quot;<span style="color: blue">/&gt;
            &lt;/</span><span style="color: #2b91af">xsl:call-template</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">a</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #2b91af">xsl:if </span><span style="color: red">test</span><span style="color: blue">=</span>&quot;<span style="color: blue">$thisNode/@Created_x0020_Date.ifnew='1'</span>&quot;<span style="color: blue">&gt;
            &lt;</span><span style="color: #2b91af">xsl:call-template </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">NewGif</span>&quot;<span style="color: blue">&gt;
                &lt;</span><span style="color: #2b91af">xsl:with-param </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">thisNode</span>&quot; <span style="color: red">select</span><span style="color: blue">=</span>&quot;<span style="color: blue">$thisNode</span>&quot;<span style="color: blue">/&gt;
            &lt;/</span><span style="color: #2b91af">xsl:call-template</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #2b91af">xsl:if</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #2b91af">xsl:template</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #2b91af">xsl:stylesheet</span><span style="color: blue">&gt;
</span></pre>

<p>Now there is a value shown in my field, and it is the same as the value of Title. </p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/4466.image_5D0C8B3B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/4466.image_5F00_5D0C8B3B.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/2072.image_thumb_675DAF9B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/2072.image_5F00_thumb_5F00_675DAF9B.png" width="566" height="81" /></a></p>

<p>The final step is to edit TitleEx in SharePoint Design and enable <em>Show List Item Menu</em> on it. After that, we will be able to see the ECB menu on this field. The result is below. It shows the “Edit in Microsoft Word” correctly.</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/8880.image_264F3037.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/8880.image_5F00_264F3037.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/2110.image_thumb_4BD8AD98.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/2110.image_5F00_thumb_5F00_4BD8AD98.png" width="565" height="231" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/06/91/46/CTypeTitleEx.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-06-91-46/CTypeTitleEx.zip">CTypeTitleEx.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Enabling ECB menu on a custom column in SharePoint 2010 (Part 1)</title>
      <link>https://docs.microsoft.com/archive/blogs/chunliu/enabling-ecb-menu-on-a-custom-column-in-sharepoint-2010-part-1</link>
      <pubDate>Mon, 27 Sep 2010 01:07:17 GMT</pubDate>
      <dc:creator><![CDATA[Chun Liu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chunliu/2010/09/27/enabling-ecb-menu-on-a-custom-column-in-sharepoint-2010-part-1/</guid>
      <description><![CDATA[If you have ever tried to enable the ECB menu on a column other than Name or Title in MOSS 2007, you...]]></description>
      <content:encoded><![CDATA[<p>If you have ever tried to enable the ECB menu on a column other than Name or Title in MOSS 2007, you will love a new feature of SharePoint 2010, <em>Show List Item Menu</em>, like the screenshot below. This feature allows us to enable the ECB menu on almost all columns. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/5228.image_024336AB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/5228.image_5F00_024336AB.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/2727.image_thumb_304CC0FE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/2727.image_5F00_thumb_5F00_304CC0FE.png" width="436" height="171" /></a></p>  <p>In SharePoint Designer, if we select this option and save our changes, the ECB menu will be enabled on this column. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/3666.image_744BA540.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/3666.image_5F00_744BA540.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/2185.image_thumb_486B2B84.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/2185.image_5F00_thumb_5F00_486B2B84.png" width="519" height="133" /></a></p>  <p>It works very well on the columns in lists. However, there is a little problem when we use this feature on a column in the document library. For example, when I enable the ECB menu on Title of a document library, the ECB menu is displayed as below. ( I also put a screenshot for the ECB on Name column for the contrast. )</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/5756.image_14DEF6C1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/5756.image_5F00_14DEF6C1.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/0434.image_thumb_3260ABF3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/0434.image_5F00_thumb_5F00_3260ABF3.png" width="448" height="211" /></a></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/7612.image_1DE2989D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/7612.image_5F00_1DE2989D.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/2450.image_thumb_1DA2C310.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/2450.image_5F00_thumb_5F00_1DA2C310.png" width="311" height="227" /></a></p>  <p>It shows “<em>Edit in undefined</em>” instead of “<em>Edit in Microsoft Word</em>” which is expected to be shown. And if I click on this menu item, I got the following error with no surprise, although Microsoft Word has been installed on this machine.&#160; </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/0211.image_0FFC18D6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/0211.image_5F00_0FFC18D6.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/6131.image_thumb_3DBEDB2F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/6131.image_5F00_thumb_5F00_3DBEDB2F.png" width="447" height="207" /></a></p>  <p>Why this problem happens is because in SharePoint 2010 the ECB menu is generated and rendered by a set of JavaScript calls dynamically. When in document library, those calls will try to determine the document type with the current column and add a menu item displayed as “Edit in Microsoft Word” or “Edit in Microsoft Excel” etc according to the type returned. <strike>For Name column whose field type is LinkFilename, the JavaScript calls can retrieve the file type because this column has a reference to the field FileLeafRef. But for Title column here, since it does not have the reference to FileLeafRef, the calls simply return an <em>undefined.</em></strike><em>&#160; </em>For some reason, these JavaScript calls work fine with the Name column whose field type is LinkFilename. The document type can be retrieved. But for the Title column, the calls simply return an <em>undefined</em>. Looks like the code does not check whether the returned value is undefined or not, therefore we see “Edit in undefined” in the menu. </p>  <p>This might be a bug of the code. At least an error checking here is necessary. If the returned value is undefined, the ugly “Edit in undefined” should not be shown. But before there is an official fix, actually I have no idea whether it will be fixed or not, is there any way to enable an ECB menu with “Edit in Microsoft Word” on Title column? Well, I am going to answer this question in the part 2 of this topic. </p>]]></content:encoded>
    </item>
    <item>
      <title>Creating a Custom Login Page for Windows Authentication</title>
      <link>https://docs.microsoft.com/archive/blogs/chunliu/creating-a-custom-login-page-for-windows-authentication</link>
      <pubDate>Tue, 21 Sep 2010 00:33:00 GMT</pubDate>
      <dc:creator><![CDATA[Chun Liu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chunliu/2010/09/21/creating-a-custom-login-page-for-windows-authentication/</guid>
      <description><![CDATA[A month ago, I wrote an article talking about how to create a custom login page for FBA in...]]></description>
      <content:encoded><![CDATA[<p>A month ago, I wrote <a target="_blank" href="https://blogs.msdn.com/b/chunliu/archive/2010/08/21/creating-a-custom-login-page-for-fba-in-sharepoint-2010.aspx">an article</a> talking about how to create a custom login page for FBA in SharePoint 2010. Since then, I got some enquiries asking whether it is possible to do the same thing for Windows Authentication. So I did some research and created another demo, and here comes this article. Again, I don&rsquo;t know whether this is a supported way. So you&rsquo;ll have to take your own risk when you use it in your production.</p>
<p><strong>Preparation</strong></p>
<p>In this demo, I am dealing with the following scenario. Say in my org every user has his/her own Personal Identity Number (PIN). When they login to the SharePoint site, in addition to the user credential of AD, I also want them to use their PIN as a double check. I don&rsquo;t want them input anything except PIN. Here comes how I do it by customizing the login page of the Windows Authentication. </p>
<p>In a Claims-mode web app, the Windows Authentication is handled by /_windows/default.aspx. If we check the path of the virtual folder /_windows, it points to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IDENTITYMODEL\WINDOWS. Obviously, modifying the files in this folder directly is not a good idea. So what I did first is to create another folder, copy all files (default.aspx and web.config) in the above folder to the folder I created, and modify the path of the virtual folder to point to the new folder. I tested the site with the new folder. Everything works fine. </p>
<p><strong>Creating a Customer Login Page</strong></p>
<p>All the same as what I did for the login page for FBA, I created a page using simple.master. Since there is no need for users to input user name and password, a login control is not necessary. Instead, I just put a textbox, a button and several labels on the page. The layout looks like the following. </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/5554.image_6950BA6F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/5554.image_5F00_6950BA6F.png"><img height="226" width="502" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/36/23/metablogapi/1663.image_thumb_18EAC4FD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-36-23-metablogapi/1663.image_5F00_thumb_5F00_18EAC4FD.png" alt="image" border="0" title="image" style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" /></a></p>
<p><strong>Creating a Code Behind Class to Handle the Request</strong></p>
<p>I then created a class named as WindowsSignInPage and make it derive from IdentityModelSignInPageBase just like the forms sign in page. Again, I added all necessary assembly references. </p>
<p>Now it is time to write the logic to handle the real authentication. Different from the Forms authentication, in Windows authentication in Claims mode users are not authenticated by /_windows/default.aspx directly. Instead, they are authenticated by an HttpModule, SPWindowsClaimsAuthenticationHttpModule. When a user browse the web site and reaches /_windows/default.aspx, he/she has already passed the Windows authentication performed by that HttpModule. So to force users to input their PIN on the page, we must sign them out first. The following is the code I added in Page_Load. </p>
<pre class="code"><span style="color: #2b91af">IClaimsIdentity </span>claimsIdentity =
    <span style="color: #2b91af">HttpContext</span>.Current.User.Identity <span style="color: blue">as </span><span style="color: #2b91af">IClaimsIdentity</span>;
<span style="color: blue">if </span>(claimsIdentity != <span style="color: blue">null</span>)
{
    CurrentUserLit.Text = claimsIdentity.GetDisplayName();
}
<span style="color: blue">else
</span>{
    CurrentUserLit.Text = <span style="color: #2b91af">HttpContext</span>.Current.User.Identity.Name;
}

<span style="color: #2b91af">SecurityToken </span>token = <span style="color: #2b91af">SPSecurityContext</span>.SecurityTokenForContext(Context.Request.Url);
<span style="color: #2b91af">HttpCookie </span>signInCookie = Context.Request.Cookies[<span style="color: #a31515">"Morpheus_WindowsSignedIn"</span>];
<span style="color: blue">if </span>(signInCookie != <span style="color: blue">null </span>&amp;&amp; signInCookie.Value.Equals(<span style="color: #a31515">"true"</span>))
{
    RedirectToSuccessUrl();
}
<span style="color: blue">else
</span>{
    RemoveCookiesAndSignOut();
}</pre>
<p>Since the user has passed the authentication of the HttpModule, the identity we get has been an IClaimsIdentity already. Here I check my custom cookie first. If the cookie exists, means the user has input the correct PIN. Otherwise, the user is signed out so he/she must input the PIN first. </p>
<p>The code of RemoveCookieAndSignOut is as below. If you examine the code of Signout.aspx with Reflector, you will see that I am using almost the same logic with it. </p>
<pre class="code"><span style="color: blue">private void </span>RemoveCookiesAndSignOut()
{
    <span style="color: green">// Clear session state. 
    </span><span style="color: blue">if </span>(Context.Session != <span style="color: blue">null</span>)
    {
        Context.Session.Clear();
    }

    <span style="color: blue">string </span>cookieValue = <span style="color: blue">string</span>.Empty;
    <span style="color: blue">if </span>(Context.Request.Browser[<span style="color: #a31515">"supportsEmptyStringInCookieValue"</span>] == <span style="color: #a31515">"false"</span>)
        cookieValue = <span style="color: #a31515">"NoCookie"</span>;

    <span style="color: green">// Clear my own cookie.
    </span><span style="color: #2b91af">HttpCookie </span>cookieWinSignIn = Context.Request.Cookies[<span style="color: #a31515">"Morpheus_WindowsSignedIn"</span>];
    <span style="color: blue">if </span>(cookieWinSignIn != <span style="color: blue">null</span>)
    {
        cookieWinSignIn.Value = cookieValue;
        Context.Response.Cookies.Remove(<span style="color: #a31515">"Morpheus_WindowsSignedIn"</span>);
        Context.Response.Cookies.Add(cookieWinSignIn);
    }

    <span style="color: green">// Remove cookies for authentication. 
    </span><span style="color: #2b91af">HttpCookie </span>cookieSession = Context.Request.Cookies[<span style="color: #a31515">"WSS_KeepSessionAuthenticated"</span>];
    <span style="color: blue">if </span>(cookieSession != <span style="color: blue">null</span>)
    {
        cookieSession.Value = cookieValue;
        Context.Response.Cookies.Remove(<span style="color: #a31515">"WSS_KeepSessionAuthenticated"</span>);
        Context.Response.Cookies.Add(cookieSession);
    }

    <span style="color: #2b91af">HttpCookie </span>cookiePersist = Context.Request.Cookies[<span style="color: #a31515">"MSOWebPartPage_AnonymousAccessCookie"</span>];
    <span style="color: blue">if </span>(cookiePersist != <span style="color: blue">null</span>)
    {
        cookiePersist.Value = cookieValue;
        cookiePersist.Expires = <span style="color: blue">new </span><span style="color: #2b91af">DateTime</span>(1970, 1, 1);
        Context.Response.Cookies.Remove(<span style="color: #a31515">"MSOWebPartPage_AnonymousAccessCookie"</span>);
        Context.Response.Cookies.Add(cookiePersist);
    }

    <span style="color: green">// Sign out.
    </span>Microsoft.IdentityModel.Web.<span style="color: #2b91af">FederatedAuthentication</span>.SessionAuthenticationModule.SignOut();
}</pre>
<p>The final part is very simple. When the user clicks the submit button, I check his/her PIN first. If the PIN is correct, I set the cookie and redirect him/her to this page again so that the HttpModule authenticates the user again. </p>
<pre class="code"><span style="color: blue">protected void </span>LoginBtn_Click(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e)
{
    <span style="color: green">// Check whether the PIN is correct.
    </span><span style="color: blue">if </span>(!<span style="color: blue">string</span>.Equals(pinCode.Text.ToLower(), pinLit.Text.ToLower()))
    {
        ClaimsFormsPageMessage.Text = <span style="color: #a31515">"The PIN is incorrect."</span>;
        <span style="color: blue">return</span>;
    }

    <span style="color: green">// Set cookie and redirect to the sign in page
    // so the SPWindowsClaimsAuthenticationHttpModule can sign us in again.
    </span><span style="color: #2b91af">HttpCookie </span>cookie = Context.Request.Cookies[<span style="color: #a31515">"Morpheus_WindowsSignedIn"</span>];
    <span style="color: blue">if </span>(cookie == <span style="color: blue">null</span>)
    {
        cookie = <span style="color: blue">new </span><span style="color: #2b91af">HttpCookie</span>(<span style="color: #a31515">"Morpheus_WindowsSignedIn"</span>);
    }
    <span style="color: blue">else
    </span>{
        Context.Response.Cookies.Remove(<span style="color: #a31515">"Morpheus_WindowsSignedIn"</span>);
    }
    cookie.Value = <span style="color: #a31515">"true"</span>;
    cookie.Expires = <span style="color: #2b91af">DateTime</span>.Now.AddMinutes(1); <span style="color: green">// 1 minute for testing purpose.
    </span>Context.Response.Cookies.Add(cookie);
    <span style="color: #2b91af">SPUtility</span>.Redirect(<span style="color: #a31515">"/_windows/default.aspx"</span>, <span style="color: #2b91af">SPRedirectFlags</span>.Default, Context);
}</pre>
<p><strong>Deploying and Testing</strong></p>
<p>To deploy the page, connect the default.aspx and the assembly by adding a &lt;%@ Page %&gt; indicator, put default.aspx in /_windows and the assembly in GAC, and reset the app pool. Then browse the site to see the result. </p>
<p>The attachment is the source code of the demo. </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/06/55/00/WindowsSignInPage.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-06-55-00/WindowsSignInPage.zip">WindowsSignInPage.zip</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>