<?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>John W Powell</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/johnwpowell/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/johnwpowell/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 01 Apr 2015 14:35:47 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Create a SharePoint Custom Action to Zip and Download a Document Set</title>
      <link>https://docs.microsoft.com/archive/blogs/johnwpowell/create-a-sharepoint-custom-action-to-zip-and-download-a-document-set</link>
      <pubDate>Sat, 21 Jan 2012 07:13:02 GMT</pubDate>
      <dc:creator><![CDATA[johnwpowell]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/johnwpowell/2012/01/21/create-a-sharepoint-custom-action-to-zip-and-download-a-document-set/</guid>
      <description><![CDATA[I like writing code, but I love solving problems using the simplest possible approach even...]]></description>
      <content:encoded><![CDATA[<p> I like writing code, but I love solving problems using the simplest possible approach even more.&#160; In this article, I’m going to show you how to enable users to zip and download all documents in a document set with no code.&#160; The document set feature already provides the zip and download capability, so you just need to make&#160; it easy for users to access it.&#160; </p>  <p>Here’s the URL to the built-in document set downloader page: {SiteUrl}/_layouts/DocSetExport.aspx?List={ListId}&amp;ID={ItemId}.&#160; It takes in the GUID of the list and the ID of the document set.&#160; Here’s an example: <a title="https://sharepoint2010/sites/docman/_layouts/DocSetExport.aspx?List={4E2D11F5-7500-476A-B001-62A7BF92FD50}&amp;ID=10" href="https://sharepoint2010/sites/docman/_layouts/DocSetExport.aspx?List={4E2D11F5-7500-476A-B001-62A7BF92FD50}&amp;ID=10">https://sharepoint2010/sites/docman/_layouts/DocSetExport.aspx?List={4E2D11F5-7500-476A-B001-62A7BF92FD50}&amp;ID=10</a></p>  <h5>Adding a Custom Action to the Document Set List Item Menu using SharePoint Designer</h5>  <p>To add a custom action, open the site in SharePoint Designer and navigate to the document set list.&#160; Add a new list item menu custom action:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/0081.image_4E75FDF8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/0081.image_5F00_4E75FDF8.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/3542.image_thumb_5F7A2BDB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/3542.image_5F00_thumb_5F00_5F7A2BDB.png" width="175" height="189" /></a></p>  <p>Provide a Name, Description, and Navigate to URL:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/3036.image_2CAA2567.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/3036.image_5F00_2CAA2567.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/1884.image_thumb_0BB6B2C0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/1884.image_5F00_thumb_5F00_0BB6B2C0.png" width="437" height="386" /></a></p>  <p>Save the custom action, and test it:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/3146.image_35B6B0E8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/3146.image_5F00_35B6B0E8.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/0486.image_thumb_02E6AA74.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/0486.image_5F00_thumb_5F00_02E6AA74.png" width="454" height="222" /></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/00/25/metablogapi/6266.image_13EAD857.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/6266.image_5F00_13EAD857.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/4617.image_thumb_59FB956A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/4617.image_5F00_thumb_5F00_59FB956A.png" width="244" height="162" /></a></p>  <p>I want to mention that there is a drawback to this approach.&#160; The custom action will show up for every list item, not just the document set.&#160; The list item menu will appear on documents in the document set as well:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/6170.image_200C527E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/6170.image_5F00_200C527E.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/4617.image_thumb_466E35C9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/4617.image_5F00_thumb_5F00_466E35C9.png" width="244" height="72" /></a></p>  <h5>Adding a Custom Action to the Document Set Ribbon using SharePoint Designer</h5>  <p>We can also use SharePoint Designer to add a button to the document set ribbon, but the user experience isn’t ideal.&#160; You’re better off creating this custom action in a sandboxed (or farm) solution.&#160; The reason for this is that custom actions created in SharePoint Designer operate on a list item, so the user has to select a list item before the ribbon button lights up to zip and download the document set.&#160; Understanding the limitations, here’s how to do it:</p>  <p>Add a new view ribbon custom action:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/1464.image_65B0DC9C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/1464.image_5F00_65B0DC9C.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/2548.image_thumb_700200FC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/2548.image_5F00_thumb_5F00_700200FC.png" width="177" height="188" /></a></p>  <p>Enter a Name and Description as before, but this time use JavaScript for the custom action.&#160; We need script to get the ID of the document set rather than the ID of the selected item.&#160; Enter the following for the Navigate to URL:</p>  <p>javascript:function getQS(key){var regex=new RegExp('[\\?&amp;]'+key+'=([^&amp;#]*)');var qs=regex.exec(window.location.href);return qs[1];}var url='{SiteUrl}/_layouts/DocSetExport.aspx?List={ListId}&amp;ID='+getQS(&quot;ID&quot;);window.location.href=url;</p>  <p>Now when you select a document the zip and download button lights up:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/1070.image_3612BE10.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/1070.image_5F00_3612BE10.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/8321.image_thumb_4E36286B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/8321.image_5F00_thumb_5F00_4E36286B.png" width="185" height="244" /></a></p>  <h5>Adding Custom Actions to the Document Set List Item Menu using a Sandboxed Solution</h5>  <p>Next, I’ll show you how to create a sandboxed solution that provides a better user experience and is reusable across sites.&#160; The solution deploys both the list item and document set ribbon and scopes the custom action to just the document set content type.&#160; To get started, create a new empty SharePoint project in Visual Studio 2010.&#160; Add a feature and name it DocSetDownload.&#160; Add a new Elements item named CustomActions.&#160; Add the following to the Elements.xml file</p>  <pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Elements</span> <span style="color: #ff0000">xmlns</span>=<span style="color: #0000ff">&quot;https://schemas.microsoft.com/sharepoint/&quot;</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  <span style="color: #0000ff">&lt;</span><span style="color: #800000">CustomAction</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">Id</span>=<span style="color: #0000ff">&quot;DocSetDownload.Ribbon&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">Title</span>=<span style="color: #0000ff">&quot;Zip and Download&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">Description</span>=<span style="color: #0000ff">&quot;Zip all documents in this document set and download.&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">RegistrationType</span>=<span style="color: #0000ff">&quot;ContentType&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">RegistrationId</span>=<span style="color: #0000ff">&quot;0x0120D520&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">Location</span>=<span style="color: #0000ff">&quot;CommandUI.Ribbon&quot;</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">CommandUIExtension</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">      <span style="color: #0000ff">&lt;</span><span style="color: #800000">CommandUIDefinitions</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">CommandUIDefinition</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">          <span style="color: #ff0000">Location</span>=<span style="color: #0000ff">&quot;Ribbon.ManageDocumentSet.MDS.Share.Controls._children&quot;</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">          <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #ff0000">Id</span>=<span style="color: #0000ff">&quot;Ribbon.ManageDocumentSet.MDS.Share.Controls.DocSetDownload&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #ff0000">Sequence</span>=<span style="color: #0000ff">&quot;20&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #ff0000">Command</span>=<span style="color: #0000ff">&quot;Ribbon.ManageDocumentSet.MDS.Share.DocSetDownload&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #ff0000">Alt</span>=<span style="color: #0000ff">&quot;Zip and Download&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #ff0000">Image16by16</span>=<span style="color: #0000ff">&quot;images/DocSetDownload16x16.png&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #ff0000">Image32by32</span>=<span style="color: #0000ff">&quot;images/DocSetDownload32x32.png&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #ff0000">LabelText</span>=<span style="color: #0000ff">&quot;Zip and Download&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #ff0000">ToolTipTitle</span>=<span style="color: #0000ff">&quot;Zip and Download&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #ff0000">ToolTipDescription</span>=<span style="color: #0000ff">&quot;Zip all documents in this document set and download.&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #ff0000">TemplateAlias</span>=<span style="color: #0000ff">&quot;o1&quot;</span> <span style="color: #0000ff">/&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        <span style="color: #0000ff">&lt;/</span><span style="color: #800000">CommandUIDefinition</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">      <span style="color: #0000ff">&lt;/</span><span style="color: #800000">CommandUIDefinitions</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">      <span style="color: #0000ff">&lt;</span><span style="color: #800000">CommandUIHandlers</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">CommandUIHandler</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">          <span style="color: #ff0000">Command</span>=<span style="color: #0000ff">&quot;Ribbon.ManageDocumentSet.MDS.Share.DocSetDownload&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">          <span style="color: #ff0000">EnabledScript</span>=<span style="color: #0000ff">&quot;true&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">          <span style="color: #ff0000">CommandAction</span>=<span style="color: #0000ff">&quot;javascript:
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">          function getQS(key){
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            var regex=new RegExp('[\\?&amp;amp;]'+key+'=([^&amp;amp;#]*)');
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            var qs=regex.exec(window.location.href);
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            return qs[1];
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">          }
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">          var url='{SiteUrl}/_layouts/DocSetExport.aspx?List={ListId}&amp;amp;ID='+getQS('ID');
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">          window.location.href=url;
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">          &quot;</span> <span style="color: #0000ff">/&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">      <span style="color: #0000ff">&lt;/</span><span style="color: #800000">CommandUIHandlers</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">CommandUIExtension</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  <span style="color: #0000ff">&lt;/</span><span style="color: #800000">CustomAction</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  <span style="color: #0000ff">&lt;</span><span style="color: #800000">CustomAction</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">Id</span>=<span style="color: #0000ff">&quot;DocSetDownload.EditControlBlock&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">Title</span>=<span style="color: #0000ff">&quot;Zip and Download&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">Description</span>=<span style="color: #0000ff">&quot;Zip all documents in this document set and download.&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">RegistrationType</span>=<span style="color: #0000ff">&quot;ContentType&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">RegistrationId</span>=<span style="color: #0000ff">&quot;0x0120D520&quot;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #ff0000">Location</span>=<span style="color: #0000ff">&quot;EditControlBlock&quot;</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">UrlAction</span> <span style="color: #ff0000">Url</span>=<span style="color: #0000ff">&quot;{SiteUrl}/_layouts/DocSetExport.aspx?List={ListId}&amp;amp;ID={ItemId}&quot;</span> <span style="color: #0000ff">/&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  <span style="color: #0000ff">&lt;/</span><span style="color: #800000">CustomAction</span><span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Elements</span><span style="color: #0000ff">&gt;</span></pre></pre>

<p>Next, add a Module item named images to the project and add the custom images for the ribbon:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/5265.image_22192B7A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/5265.image_5F00_22192B7A.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/7750.image_thumb_3AA8C8CA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/7750.image_5F00_thumb_5F00_3AA8C8CA.png" width="214" height="73" /></a></p>

<p>Deploy and test the solution.&#160; You’ll see the custom action on the ribbon:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/1376.image_59EB6F9D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/1376.image_5F00_59EB6F9D.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/4760.image_thumb_6AEF9D80.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/4760.image_5F00_thumb_5F00_6AEF9D80.png" width="235" height="244" /></a></p>

<p>The custom action will also appear on the list item menu:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/6254.image_3ED2A08F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/6254.image_5F00_3ED2A08F.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/8311.image_thumb_4923C4EF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/8311.image_5F00_thumb_5F00_4923C4EF.png" width="244" height="139" /></a></p>

<p>Download the <a href="https://skydrive.live.com/redir.aspx?cid=7cedcb8ed3a44629&amp;resid=7CEDCB8ED3A44629!1502&amp;parid=7CEDCB8ED3A44629!116" target="_blank">sandboxed solution source</a> Download the <a href="https://skydrive.live.com/redir.aspx?cid=7cedcb8ed3a44629&amp;resid=7CEDCB8ED3A44629!1503&amp;parid=7CEDCB8ED3A44629!116" target="_blank">wsp file</a>.</p>

<h5>Additional Resources</h5>

<p><a href="https://msdn.microsoft.com/en-us/library/ff823726.aspx" target="_blank">SharePoint 2010 ECM Code Sample: Document Sets Ribbon and Export</a></p>]]></content:encoded>
    </item>
    <item>
      <title>How to Sort SharePoint Document Set Allowed Content Types</title>
      <link>https://docs.microsoft.com/archive/blogs/johnwpowell/how-to-sort-sharepoint-document-set-allowed-content-types</link>
      <pubDate>Fri, 06 Jan 2012 07:17:45 GMT</pubDate>
      <dc:creator><![CDATA[johnwpowell]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/johnwpowell/2012/01/06/how-to-sort-sharepoint-document-set-allowed-content-types/</guid>
      <description><![CDATA[Recently I’ve been working on a SharePoint 2010 document management solution, and this has provided...]]></description>
      <content:encoded><![CDATA[<p>Recently I’ve been working on a SharePoint 2010 document management solution, and this has provided the opportunity get deep in the weeds on features such as Document Sets, the Document ID Service, Content Organizer and In-Place Records Management.&#160; I will share more details about my experiences in future posts, but in a nutshell, the organization has an engineering process that involves producing a set of a deliverables that get approved at each stage of a process.&#160; Deliverables are conditionally provisioned based on project details, and at each stage, approved deliverables are routed into a document repository controlled by a configuration management team to support auditing.&#160; After deploying the first version of this solution, I received a high-severity bug that the project document set content types were not in alphabetical order.&#160; Although it may seem like a cosmetic/annoyance issue on the surface, considering there are approximately 125 different content types involved, it was actually making it considerably difficult for users to find and select the appropriate project document content type .&#160; In this post, I’m going to go into a bit of a rabbit hole and discuss how to solve this issue—but first, let me provide some background on the problem.</p>  <p>A Document Set is a container for multiple documents and provides the ability to treat the set as a single unit and even share properties from the container across all documents.&#160; This feature is very useful for processes where there is a “packet” of documents that move through a lifecycle such as a loan application, or in this example, a project going through an engineering process.&#160; The packet has shared information such as “Project Name,” or “Project Type,” as well as details about what types of documents go into the packet.&#160; In SharePoint, this is is implemented as a Document Set template that has information about the document content types it is allowed to contain.&#160; Rather than talking about it, let me show you:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/6471.image_3FF62841.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/6471.image_5F00_3FF62841.png" target="_blank"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/2766.image_thumb_4B3F3C7E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/2766.image_5F00_thumb_5F00_4B3F3C7E.png" width="210" height="244" /></a></p>  <p>In this example, I created a “Project Document Set” content type that inherits from “Document Set.”&#160; It has columns for the Project Name, Description and the Project Type.&#160; I’ve also defined an initial set of content types for the types of documents that the organization produces.&#160; I started with a base content type called “Deliverable,” and created several content types that inherit from it:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/8203.image_4EFCE14E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/8203.image_5F00_4EFCE14E.png" target="_blank"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/0257.image_thumb_189B9372.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/0257.image_5F00_thumb_5F00_189B9372.png" width="182" height="244" /></a></p>  <p>Now let’s edit the Document Set settings for the Project Document Set content type.&#160; The first setting is “Allowed Content Types.”&#160; This enables you to specify what types of documents can go into the set.&#160; I’ll add an initial list of deliverables.&#160; Everything seems to be going fine so far, but notice that the list on the right is already not in alphabetic order, but rather is in <strong>the order in which content types are added</strong>:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/3884.image_6161DFAB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/3884.image_5F00_6161DFAB.png" target="_blank"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/6114.image_thumb_0612F723.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/6114.image_5F00_thumb_5F00_0612F723.png" width="569" height="185" /></a></p>  <p>Next I’ll create a new Project Document set and add some documents to it.&#160; Notice that when I upload a document and edit the document properties, the Content Type drop down is in the same order as the Document set allowed content types list:</p>  <p>&#160;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/6082.image_088C0314.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/6082.image_5F00_088C0314.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/7288.image_thumb_308E8C66.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/7288.image_5F00_thumb_5F00_308E8C66.png" width="244" height="202" /></a></p>  <p>In addition, Content Types are in the same order on the New Document ribbon button:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/2376.image_38C2B1FD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/2376.image_5F00_38C2B1FD.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/4846.image_thumb_064EB8B1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/4846.image_5F00_thumb_5F00_064EB8B1.png" width="244" height="113" /></a></p>  <p>You <em>could</em> manually modify the content type order for each document set by hand by selecting each document set in the library and selecting “Change New Button Order” on the list item menu.&#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/00/25/metablogapi/2451.image_3333F5BF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/2451.image_5F00_3333F5BF.png" target="_blank"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/2055.image_thumb_46B12F93.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/2055.image_5F00_thumb_5F00_46B12F93.png" width="244" height="151" /></a></p>  <p>Although you can change the content type order for a single document set, all new Document Sets content types will have the original content type order.&#160; Another way you could try to solve this problem is to go to the Document Set settings page and remove all the content types and re-add them in alphabetical order.&#160; You may, however, encounter an error that the content type is in use:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/0383.image_7E36CAB4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/0383.image_5F00_7E36CAB4.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/25/metablogapi/7215.image_thumb_6D02ED11.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-25-metablogapi/7215.image_5F00_thumb_5F00_6D02ED11.png" width="199" height="149" /></a></p>  <p>Even if you don’t have the content type in use issue, imagine if you had 125 allowed content types and you needed to manually re-order them.&#160; When the 126th content type is added, you’d have to remove and re-add them all again.&#160; What a pain!&#160; It would be nice if the UI had an up, down and a sort alphabetically button, but since we don’t have that in this version, I have another solution: <em>PowerShell</em>.</p>  <p>This script uses the object model to remove all content types from the Document Set template, sort them, and then re-add them.&#160; It will also update all document sets in one library to use the new content type ordering.</p>  <pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;</span>#
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">This script will sort the allowed content types for a document set
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">Example: .\Sort-DocumentSetContentTypes.ps1 https://contoso.com/sites/docman &quot;Project Document Set&quot; &quot;Project Documents&quot;
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">#<span style="color: #0000ff">&gt;</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">param
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">(
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">       [string]$siteUrl = $(throw &quot;Site URL is required&quot;),
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">       [string]$docSetContentTypeName = $(throw &quot;Document set content type name is required&quot;),
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">       [string]$listToUpdate = $(throw &quot;The name of the list to update existing document sets&quot;)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$web = Get-SPWeb $siteUrl
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$dsct = $web.ContentTypes[$docSetContentTypeName]
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$dst = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSetTemplate]::GetDocumentSetTemplate($dsct)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$ctById = @{}
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">foreach($ctId in $dst.AllowedContentTypes)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">{
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">       $ct = $web.ContentTypes[$ctId]
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">       $ctById.Add($ctId, $ct)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">}
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$sorted = ($ctById.Values | Sort Name)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$dst.AllowedContentTypes.Clear()
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">foreach($ct in $sorted)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">{
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">       $dst.AllowedContentTypes.Add($ct.Id)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">}
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$dst.Update($true)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">#update all document sets
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$web.Dispose()
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$web = Get-SPWeb $siteUrl
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$list = $web.Lists[$listToUpdate]
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">foreach($folder in $list.RootFolder.Subfolders)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">{
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">       if($folder.Item.ContentType.Name -eq $dsct.Name)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">       {
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">              Write-Host &quot;Updating allowed content types for existing document set&quot; $folder.Name
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">              $docSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::GetDocumentSet($folder)
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">              # this gets rid of the &quot;Content types have been added gold bar&quot;
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">              $docSet.Provision()
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">       }
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">}</pre></pre>

<p><a href="https://skydrive.live.com/redir.aspx?cid=7cedcb8ed3a44629&amp;resid=7CEDCB8ED3A44629!1501&amp;parid=7CEDCB8ED3A44629!116&amp;authkey=!AGmOkLRIC2jPDu4" target="_blank">Download PowerShell Script</a></p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint 2010 Database Naming Standards</title>
      <link>https://docs.microsoft.com/archive/blogs/johnwpowell/sharepoint-2010-database-naming-standards</link>
      <pubDate>Sat, 20 Nov 2010 09:05:00 GMT</pubDate>
      <dc:creator><![CDATA[johnwpowell]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/johnwpowell/2010/11/20/sharepoint-2010-database-naming-standards/</guid>
      <description><![CDATA[In a previous post I made a case for following a database naming standard for SharePoint...]]></description>
      <content:encoded><![CDATA[<p>In a <a href="https://blogs.msdn.com/b/johnwpowell/archive/2009/12/15/sharepoint-database-naming-standards.aspx" target="_blank">previous post</a> I made a case for following a database naming standard for SharePoint databases.&#160; What started as an investigation into how to rename the auto-generated SharePoint 2010 databases led me down a path bordering obsession.&#160; I spent several weeks implementing a comprehensive collection of PowerShell scripts that automate upgrade from 2007 to 2010 using database attach, and rename the databases in the process.&#160; I will be sharing those scripts with the SharePoint community in the near future, but I in the mean time, I wanted to share the database naming standards that evolved from this effort.</p>  <p>It’s good to have a plan.&#160; Although my initial goal was to rename the databases with the GUIDs, I soon realized that I needed a naming standard so I knew what to rename the databases to.&#160; I wanted an approach that would accommodate multiple farms (2007 or 2010), multiple organizations, and enable you to easily identify what belongs to what.&#160; It was also important to me that the databases sorted nicely.&#160; After several iterations, here is the naming standard I arrived at:</p>  <p><font size="5"><strong>Technology_Organization_Scope_DatabaseType</strong></font></p>  <p>Here are some examples:</p>  <p>SPS2010_Contoso_Intranet_Content    <br />SPS2010_Contoso_Intranet_ProjectService_Archive     <br />SPS2010_Contoso_Intranet_ProjectService_Content     <br />SPS2010_Contoso_Intranet_ProjectService_Draft     <br />SPS2010_Contoso_Intranet_ProjectService_Published     <br />SPS2010_Contoso_Intranet_ProjectService_Reporting     <br />SPS2010_Contoso_CentralAdministration_Content     <br />SPS2010_Contoso_Farm_BDCService     <br />SPS2010_Contoso_Farm_Config     <br />SPS2010_Contoso_Farm_ManagedMetadataService     <br />SPS2010_Contoso_Farm_PowerPointService     <br />SPS2010_Contoso_Farm_ProfileService_Profile     <br />SPS2010_Contoso_Farm_ProfileService_Social     <br />SPS2010_Contoso_Farm_ProfileService_Sync     <br />SPS2010_Contoso_Farm_StateService     <br />SPS2010_Contoso_Farm_SessionStateService     <br />SPS2010_Contoso_Farm_SecureStoreService     <br />SPS2010_Contoso_Sales_Content     <br />SPS2010_NorthWind_Farm_Config     <br />SPS2010_NorthWind_Intranet_Content</p>  <p>Now for some detail on each component of the naming standard.</p>  <p><strong>Technology.</strong> <em>Required</em>.&#160; Must be one of the following:</p>  <ul>   <li>SPS2010 (SharePoint Server) </li>    <li>SPF2010 (SharePoint Foundation) </li> </ul>  <p><strong>Organization.</strong> <em>Required</em>.&#160; This is especially important when multiple organizations are on a shared infrastructure. Examples</p>  <ul>   <li>Contoso </li>    <li>Northwind </li> </ul>  <p><strong>Scope</strong>. <em>Required</em>. Typically farm or sub organization. Examples:</p>  <ul>   <li>Farm (such as config database or default service application databases) </li>    <li>Sales </li>    <li>Marketing </li> </ul>  <p><strong>Database Type</strong>.&#160; <em>Required</em>.&#160; Must be one of the following:</p>  <ul>   <li>Config </li>    <li>Content </li>    <li>BDCService </li>    <li>ManagedMetadataService </li>    <li>PerformancePointService </li>    <li>ProfileService_Profile </li>    <li>ProfileService_Sync </li>    <li>ProfileService_Social </li>    <li>ProjectService_Content </li>    <li>ProjectService_Draft </li>    <li>ProjectService_Published </li>    <li>ProjectService_Archive </li>    <li>ProjectService_Reporting </li>    <li>SearchService </li>    <li>SearchService_Crawl </li>    <li>SearchService_Property </li>    <li>SecureStoreService </li>    <li>SessionStateService </li>    <li>StateService </li>    <li>SubscriptionSettings </li>    <li>UsageService </li>    <li>WebAnalyticsService_Staging </li>    <li>WebAnalyticsService_Reporting </li>    <li>WordAutomationService </li> </ul>  <p>If you are creating a new farm, it’s fairly easy to establish the standard up front.&#160; For most, however, the decision to implement a naming standard is made after the farm is created.&#160; Here’s some recommended reading on the topic of creating and renaming SharePoint databases:</p>  <ul>   <li><a href="https://technet.microsoft.com/en-us/library/cc752946.aspx" target="_blank">Install SharePoint Foundation 2010 by using Windows PowerShell</a> </li>    <li><a href="https://technet.microsoft.com/en-us/library/ff851878.aspx" target="_blank">Rename or move service application databases</a> </li>    <li><a href="https://msmvps.com/blogs/shane/archive/2010/10/26/getting-rid-of-guids-in-sharepoint-2010-database-names.aspx" target="_blank">Getting rid of GUIDs in SharePoint 2010 database names</a> </li>    <li><a href="https://msmvps.com/blogs/shane/archive/2010/11/04/rename-the-sharepoint-2010-performancepoint-database-to-remove-the-guid.aspx" target="_blank">Rename the SharePoint 2010 PerformancePoint database to remove the GUID</a> </li> </ul>]]></content:encoded>
    </item>
    <item>
      <title>A Lap Around SharePoint 2010 Sandboxed Solutions Resource Quotas</title>
      <link>https://docs.microsoft.com/archive/blogs/johnwpowell/a-lap-around-sharepoint-2010-sandboxed-solutions-resource-quotas</link>
      <pubDate>Sun, 28 Feb 2010 23:00:00 GMT</pubDate>
      <dc:creator><![CDATA[johnwpowell]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/johnwpowell/2010/02/28/a-lap-around-sharepoint-2010-sandboxed-solutions-resource-quotas/</guid>
      <description><![CDATA[In this post, I'll demonstrate sandbox solutions resource quotas and show you what happens when they...]]></description>
      <content:encoded><![CDATA[<p>In this post, I'll demonstrate sandbox solutions resource quotas and show you what happens when they are exceeded.&nbsp; When sandboxed code executes, certain metrics are collected such as % processor time and # of unhandled exceptions.&nbsp; Timer jobs compile the metrics and calculate resource points usage.&nbsp; When the total resource points used exceeds the daily limit (300 points by default), the sandbox is turned off for the entire site collection.&nbsp; The following table describes the metrics collected and how they are normalized to resource points: </p> <table border="1" cellspacing="0" cellpadding="0" width="707"> <tbody> <tr> <td width="216"><strong><font size="2" face="ta">Resource</font></strong></td> <td width="198"><strong><font size="2" face="ta">Description</font></strong></td> <td width="71"><strong><font size="2" face="ta">Units</font></strong></td> <td width="129"><strong><font size="2" face="ta">Resources per Point</font></strong></td> <td width="91"><strong><font size="2" face="ta">Limit</font></strong></td></tr> <tr> <td width="216"><font size="2" face="ta">AbnormalProcessTerminationCount</font></td> <td width="198"><font size="2" face="ta">Abnormally terminated process</font></td> <td width="71"><font size="2" face="ta">count</font></td> <td width="129"><font size="2" face="ta">1</font></td> <td width="91"><font size="2" face="ta">1</font></td></tr> <tr> <td width="216"><font size="2" face="ta">CPUExecutionTime</font></td> <td width="198"><font size="2" face="ta">CPU Execution Time for site</font></td> <td width="71"><font size="2" face="ta">seconds</font></td> <td width="129"><font size="2" face="ta">3,600</font></td> <td width="91"><font size="2" face="ta">60</font></td></tr> <tr> <td width="216"><font size="2" face="ta">CriticalExceptionCount</font></td> <td width="198"><font size="2" face="ta">Critical Exception Events</font></td> <td width="71"><font size="2" face="ta">Events</font></td> <td width="129"><font size="2" face="ta">10</font></td> <td width="91"><font size="2" face="ta">3</font></td></tr> <tr> <td width="216"><font size="2" face="ta">InvocationCount</font></td> <td width="198"><font size="2" face="ta">Solution Invocation Events</font></td> <td width="71"><font size="2" face="ta">Events</font></td> <td width="129"><font size="2" face="ta">&lt;TBD&gt;</font></td> <td width="91"><font size="2" face="ta">&lt;TBD&gt;</font></td></tr> <tr> <td width="216"><font size="2" face="ta">PercentProcessorTime</font></td> <td width="198"><font size="2" face="ta">% CPU usage by solution</font></td> <td width="71"><font size="2" face="ta">%</font></td> <td width="129"><font size="2" face="ta">85</font></td> <td width="91"><font size="2" face="ta">100</font></td></tr> <tr> <td width="216"><font size="2" face="ta">ProcessCPUCycles</font></td> <td width="198"><font size="2" face="ta">Solution CPU cycles</font></td> <td width="71"><font size="2" face="ta">cycles</font></td> <td width="129"><font size="2" face="ta">1 x10^11</font></td> <td width="91"><font size="2" face="ta">1 x10^11</font></td></tr> <tr> <td width="216"><font size="2" face="ta">ProcessHandleCount</font></td> <td width="198"><font size="2" face="ta">Windows handles count</font></td> <td width="71"><font size="2" face="ta">items</font></td> <td width="129"><font size="2" face="ta">10,000</font></td> <td width="91"><font size="2" face="ta">1,000</font></td></tr> <tr> <td width="216"><font size="2" face="ta">ProcessIOBytes</font></td> <td width="198"><font size="2" face="ta">Windows handles count</font></td> <td width="71"><font size="2" face="ta">items</font></td> <td width="129"><font size="2" face="ta">0</font></td> <td width="91"><font size="2" face="ta">1 x10^8</font></td></tr> <tr> <td width="216"><font size="2" face="ta">ProcessThreadCount</font></td> <td width="198"><font size="2" face="ta">Thread count in overall process</font></td> <td width="71"><font size="2" face="ta">Thread instances</font></td> <td width="129"><font size="2" face="ta">10,000</font></td> <td width="91"><font size="2" face="ta">200</font></td></tr> <tr> <td width="216"><font size="2" face="ta">ProcessVirtualBytes</font></td> <td width="198"><font size="2" face="ta">Memory consumed</font></td> <td width="71"><font size="2" face="ta">Bytes</font></td> <td width="129"><font size="2" face="ta">0</font></td> <td width="91"><font size="2" face="ta">1.0x10^9</font></td></tr> <tr> <td width="216"><font size="2" face="ta">SharePointDatabaseQueryCount</font></td> <td width="198"><font size="2" face="ta">Number of SharePoint database queries</font></td> <td width="71"><font size="2" face="ta">Query instances</font></td> <td width="129"><font size="2" face="ta">20</font></td> <td width="91"><font size="2" face="ta">100</font></td></tr> <tr> <td width="216"><font size="2" face="ta">SharePointDatabaseQueryTime</font></td> <td width="198"><font size="2" face="ta">Elapsed time to execute query</font></td> <td width="71"><font size="2" face="ta">seconds</font></td> <td width="129"><font size="2" face="ta">120</font></td> <td width="91"><font size="2" face="ta">60</font></td></tr> <tr> <td width="216"><font size="2" face="ta">UnhandledExceptionCount</font></td> <td width="198"><font size="2" face="ta">Number of unhandled exceptions</font></td> <td width="71"><font size="2" face="ta">Unhandled exception instances</font></td> <td width="129"><font size="2" face="ta">50</font></td> <td width="91"><font size="2" face="ta">3</font></td></tr> <tr> <td width="216"><font size="2" face="ta">UnresponsiveProcessCount</font></td> <td width="198"><font size="2" face="ta">Number of unresponsive processes</font></td> <td width="71"><font size="2" face="ta">Unresponsive process instances</font></td> <td width="129"><font size="2" face="ta">2</font></td> <td width="91"><font size="2" face="ta">1 </font></td></tr></tbody></table> <p>For example, if you developed a sandboxed web part that displayed data from a list, it would perform a SharePoint database query each time it loads.&nbsp; 20 database queries = 1 resource point, so if the web part was displayed 20 times, the site collection would have used 1 resource point.&nbsp; The default site collection maximum is 300 points, so the web part could be displayed 6,000 times in a 24 hour period; after that, the sandbox is turned off until a timer job resets it.&nbsp; It's important to understand is that <strong>resource quotas can be exceeded through high usage and</strong>&nbsp;<strong>is not necessarily an indicator of poorly written code</strong>.&nbsp; Quotas may need to be adjusted based on usage patterns, and the 300 point default is not a one-size fits all setting.&nbsp; Another important point is that <strong>resource usage is calculated by timer jobs, so it is possible for the quota to be exceeded until the timer jobs run</strong>.&nbsp; Sandboxed code will not be terminated mid-execution.&nbsp; <h3>Create Resource Quota Template</h3> <p>To demonstrate resource quotas, we'll create a resource quota template that only allows 1 resource point per day and create a sandbox web part that throws exceptions.&nbsp; First, we must create a template.&nbsp; Go to <em>Central Administration</em> &gt; <em>Application Management</em> &gt; <em>Specify Quota Templates</em>.&nbsp; Select <em>Create a new quota template</em> and provide a name.&nbsp; Set the maximum usage per day to 1 point:  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_2.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_2.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_thumb.png" width="640" height="334"></a>  <p>Next, the template must be associated to a site collection.&nbsp; <em>Navigate to Application Management</em> &gt; <em>Configure Quotas and Locks</em> and select the site collection and the quota template:  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_4.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_4.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_thumb_1.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_thumb_1.png" width="640" height="388"></a>&nbsp; <h3>Create Sandboxed Web Part</h3> <p>Create a sandbox solution with a web part that throws an unhandled exception, for example:</p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7b37c724-1c8b-4a84-bb86-39e1301bce12" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"> <div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px">Code Snippet</div> <div style="background: #ddd; overflow: auto"> <ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"> <li><span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#0000ff">void</span> CreateChildControls()</li> <li style="background: #f3f3f3">{</li> <li>    <span style="color:#0000ff">var</span> button = <span style="color:#0000ff">new</span> <span style="color:#2b91af">Button</span>();</li> <li style="background: #f3f3f3">    button.Text = <span style="color:#a31515">&quot;Exception&quot;</span>;</li> <li>    button.Click += <span style="color:#0000ff">new</span> <span style="color:#2b91af">EventHandler</span>(button_Click);</li> <li style="background: #f3f3f3">    <span style="color:#0000ff">this</span>.Controls.Add(button);</li> <li>    <span style="color:#0000ff">base</span>.CreateChildControls();</li> <li style="background: #f3f3f3">}</li> <li>&nbsp;</li> <li style="background: #f3f3f3"><span style="color:#0000ff">void</span> button_Click(<span style="color:#0000ff">object</span> sender, <span style="color:#2b91af">EventArgs</span> e)</li> <li>{</li> <li style="background: #f3f3f3">    <span style="color:#0000ff">throw</span> <span style="color:#0000ff">new</span> <span style="color:#2b91af">NotImplementedException</span>();</li> <li>}</li> </ol> </div> </div> </div> <p>&nbsp; <p>Add the web part to a page.&nbsp; Now we know that 3 unhandled exceptions is the limit, so click the exception button 3 times.  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_6.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_6.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_thumb_2.png" width="609" height="257"></a>  <p>&nbsp; <p>Since we configured the site collection to use a maximum of 1 resource point per day, you might expect that when you clicked the button a 4th time the execution would be blocked, but usage is calculated by timer jobs.&nbsp; If you open the solution gallery, you'll see that no resource points have been used:  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled3_2.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled3_2.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Untitled3" border="0" alt="Untitled3" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled3_thumb.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled3_thumb.png" width="640" height="88"></a>  <h3>Execute Resource Usage Timer Jobs</h3> <p>Next, we'll manually run the timer jobs to calculate resource usage.&nbsp; Navigate to <em>Monitoring</em> &gt; <em>Review Job Definitions</em>, and you'll find 3 timer jobs <em>for each web application</em>:&nbsp; </p> <table border="1" cellspacing="0" cellpadding="2" width="789"> <tbody> <tr> <td valign="top" width="143"><strong>Name</strong></td> <td valign="top" width="144"><strong>Frequency</strong></td> <td valign="top" width="500"><strong>Description</strong></td></tr> <tr> <td valign="top" width="143">Solution Resource Usage Log Processing</td> <td valign="top" width="144">5 minutes</td> <td valign="top" width="500">Aggregates resource usage data from sandboxed solution execution</td></tr> <tr> <td valign="top" width="143">Solution Resource Usage Update</td> <td valign="top" width="144">15 minutes</td> <td valign="top" width="500">Records resource usage data from sandboxed solution execution, and sends email to owners of the site collection that are exceeding their allocated resource quota.</td></tr> <tr> <td valign="top" width="143">Solution Daily Resource Usage Update</td> <td valign="top" width="153">Daily</td> <td valign="top" width="500">Marks the daily boundary for sandboxed solution resource quota monitoring.</td></tr></tbody></table> <p>First, run the usage log processing job for the site collection by clicking "Run Now":</p> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_10.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_thumb_4.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_thumb_4.png" width="640" height="274"></a> </p> <p>Next, run the usage update job for the site collection:</p> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_12.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_thumb_5.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/image_thumb_5.png" width="640" height="274"></a> </p> <p>Return to the solution gallery and you'll notice the daily usage has been updated.&nbsp; The site collection sandbox has also been turned off since we used 1 resource point. <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled2_2.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled2_2.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Untitled2" border="0" alt="Untitled2" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled2_thumb.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled2_thumb.png" width="640" height="88"></a>  <p>When the sandbox has been turned off, you'll see the following message when you access the page containing the sandboxed web part: <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled_2.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled_2.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Untitled" border="0" alt="Untitled" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled_thumb.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/Untitled_thumb.png" width="674" height="21"></a>  <p>To reset, run the Solution Daily Resource Usage Update timer job:&nbsp; <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/clip_image010%5B4%5D.jpg" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/clip_image010%5B4%5D.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image010[4]" border="0" alt="clip_image010[4]" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/clip_image010%5B4%5D_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ALapAroundSharePoint2010SandboxSolutions_CF9D/clip_image010%5B4%5D_thumb.jpg" width="625" height="449"></a>  <h3>Summary</h3> <p>In this post, I demonstrated sandboxed solution resource quotas and what happens when the quota is exceeded.&nbsp; The main purpose of resource quotas is to limit the risk that custom code will negatively impact the server farm.&nbsp; Since custom code is the leading cause of support calls, sandboxed solutions and resource quotas provide a measure of confidence not afforded by SharePoint 2007. <h3>References</h3> <ul> <li><a href="https://technet.microsoft.com/en-us/library/ee721991(office.14).aspx" target="_blank">Plan for Sandbox Solutions</a></li></ul>]]></content:encoded>
    </item>
    <item>
      <title>Write to the SharePoint 2010 Developer Dashboard With JavaScript</title>
      <link>https://docs.microsoft.com/archive/blogs/johnwpowell/write-to-the-sharepoint-2010-developer-dashboard-with-javascript</link>
      <pubDate>Sun, 27 Dec 2009 09:48:35 GMT</pubDate>
      <dc:creator><![CDATA[johnwpowell]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/johnwpowell/2009/12/27/write-to-the-sharepoint-2010-developer-dashboard-with-javascript/</guid>
      <description><![CDATA[When developing JavaScript solutions, I like to provide a tracing mechanism that can be turned on...]]></description>
      <content:encoded><![CDATA[<p>When developing JavaScript solutions, I like to provide a tracing mechanism that can be turned on and off to aid debugging.&#160; The IE Developer Tools, debugger and Fiddler are very robust debugging tools, but they don’t enable client script code to trace custom messages to a “log” that can be reviewed by developers.&#160; The SharePoint 2010 Developer Dashboard is designed for server-side tracing, but it can also be used for client-side trace messages.&#160; The approach is simple: tracing code in your client script appends html to the Developer Dashboard when the Dashboard is visible.&#160; Here is the JavaScript (note this version depends on <a href="https://jquery.com/" target="_blank">jQuery</a>):</p>  <p><span style="color: blue">function </span>DeveloperDashboardSection(sectionId, sectionTitle) {    <br />&#160;&#160;&#160; <span style="color: blue">this</span>.Title = sectionTitle;    <br />&#160;&#160;&#160; <span style="color: blue">this</span>.Id = sectionId;    <br />}    <br />    <br />DeveloperDashboardSection.prototype = {    <br />    <br />&#160;&#160;&#160; Id: <span style="color: maroon">''</span>,    <br />&#160;&#160;&#160; Title: <span style="color: maroon">''</span>,    <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; DeveloperDashboardVisible: <span style="color: blue">function</span>() {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">return</span>$(<span style="color: maroon">'DeveloperDashboard'</span>).length;    <br />&#160;&#160;&#160; },    <br />    <br />&#160;&#160;&#160; EnsureSection: <span style="color: blue">function</span>() {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">var </span>section = $(<span style="color: maroon">'#'</span>+ <span style="color: blue">this</span>.Id);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">if</span>(!section.length) {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">var </span>sectionHtml = <span style="color: maroon">&quot;&lt;table id='&quot;</span>+ <span style="color: blue">this</span>.Id + <span style="color: maroon">&quot;' width='49%'&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th colspan='2'&gt;&quot;</span>+ <span style="color: blue">this</span>.Title + <span style="color: maroon">&quot;&lt;/th&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&quot;</span>;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(<span style="color: maroon">'#CurrentScopeValues'</span>).append(sectionHtml);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160; },    <br />    <br />&#160;&#160;&#160; AddEntry: <span style="color: blue">function</span>(context, message) {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">if</span>(!<span style="color: blue">this</span>.DeveloperDashboardVisible) <span style="color: blue">return</span>;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">this</span>.EnsureSection();    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">var </span>entryHtml = <span style="color: maroon">&quot;&lt;tr&gt;&lt;td nowrap='nowrap'&gt;&lt;span&gt;&quot;</span>+ context + <span style="color: maroon">&quot;&lt;/span&gt;&lt;/td&gt;&lt;td nowrap='nowrap'&gt;&lt;span&gt;&quot;</span>+ message + <span style="color: maroon">&quot;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&quot;</span>;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(<span style="color: maroon">'#'</span>+ <span style="color: blue">this</span>.Id).append(entryHtml);    <br />&#160;&#160;&#160; }    <br />};    <br /></p>  <p>To use the script, create an instance of the DeveloperDashboardSection and use the instance throughout your code to trace custom messages to the Dashboard:</p>  <p>var theSection = new DeveloperDashboardSection('sampleId', 'Custom Section');   <br />theSection.AddEntry('someMethod()', 'The method was called');</p>  <p>The messages will appear on the Developer Dashboard in it’s own section:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/WritetotheSharePoint2010DeveloperDashboa_B421/image_2.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/WritetotheSharePoint2010DeveloperDashboa_B421/image_2.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/WritetotheSharePoint2010DeveloperDashboa_B421/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/WritetotheSharePoint2010DeveloperDashboa_B421/image_thumb.png" width="262" height="61" /></a> </p>  <p>When the Dashboard is not visible, the tracing calls are benign.</p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint Database Naming Standards</title>
      <link>https://docs.microsoft.com/archive/blogs/johnwpowell/sharepoint-database-naming-standards</link>
      <pubDate>Tue, 15 Dec 2009 06:44:00 GMT</pubDate>
      <dc:creator><![CDATA[johnwpowell]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/johnwpowell/2009/12/15/sharepoint-database-naming-standards/</guid>
      <description><![CDATA[Call me picky, but I think it’s important to consistently name your SharePoint databases—especially...]]></description>
      <content:encoded><![CDATA[<P>Call me picky, but I think it’s important to consistently name your SharePoint databases—especially on a shared SQL Server hosting multiple farms and applications.&nbsp; Not only is it a good practice, but by showing that you care about the databases, you’ll earn the respect of even your most grumpiest DBAs.&nbsp; I wish the SharePoint administrative interfaces ushered you into a naming convention, but the reality is that consistent naming requires diligence and a little planning.&nbsp; I would bet that a majority of the SharePoint installations in the wild were configured using using the Products and Technology Wizard GUI.&nbsp; When you use the GUI, it creates the Central Administration content database without giving you the opportunity to provide a meaningful name.&nbsp; If you’ve seen a database named SharePoint_AdminContent_[YOURGUIDHERE], you know what I’m talking about.&nbsp; Imagine you are supporting multiple SharePoint farms—is it easy to tell which database belongs to which farm?&nbsp; Shouldn’t it be?</P>
<H3>Naming Convention</H3>
<P>Here is the naming convention I recommend for SharePoint 2007: </P>
<P><STRONG>SharePoint_[Farm Name]_[Database Type]_[Name]</STRONG> where database type is one of the following:</P>
<UL>
<LI>Config </LI>
<LI>Content </LI>
<LI>WSSSearch </LI>
<LI>SSP</LI>
<LI>SSPSearch </LI></UL>
<P>For example, the AdventureWorks MOSS 2007 Enterprise Intranet farm would have the following databases:</P>
<TABLE border=0 cellSpacing=0 cellPadding=2 width=534>
<TBODY>
<TR>
<TD vAlign=top width=277><STRONG>Database</STRONG></TD>
<TD vAlign=top width=255><STRONG>Purpose</STRONG></TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_Config</TD>
<TD vAlign=top width=255>Farm Configuration</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_Content_CA</TD>
<TD vAlign=top width=255>Central Administration Content</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_Content_Intranet</TD>
<TD vAlign=top width=255>Company Intranet Content</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_Content_DefaultSSP</TD>
<TD vAlign=top width=255>Default SSP Content</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_Content_DefaultSSPMySite</TD>
<TD vAlign=top width=255>My Site Content for Default SSP</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_Content_OtherSSP</TD>
<TD vAlign=top width=255>Other SSP Content</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_Content_OtherSSPMySite</TD>
<TD vAlign=top width=255>My Site Content for Other SSP</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_SSP_DefaultSSP</TD>
<TD vAlign=top width=255>Default SSP Database</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_SSP_OtherSSP</TD>
<TD vAlign=top width=255>Other SSP Database</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_SSPSearch_DefaultSSP</TD>
<TD vAlign=top width=255>Default SSP Search Database</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_SSPSearch_OtherSSP</TD>
<TD vAlign=top width=255>Other SSP Search Database</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_WSSSearch_SPWFE01</TD>
<TD vAlign=top width=255>WSS Help Search Web Front End 1</TD></TR>
<TR>
<TD vAlign=top width=277>SharePoint_AWIntranet_WSSSearch_SPWFE02</TD>
<TD vAlign=top width=255>WSS Help Search Web Front End 2</TD></TR></TBODY></TABLE>
<P>What I like about this naming convention is that the databases sort nicely.&nbsp; On a shared SQL Server, the SharePoint databases are separated from other application databases.&nbsp; Within SharePoint, each farm’s databases are together.&nbsp; Within each farm, the database types are together, and finally, a meaningful name makes it easy to determine which area it belongs to.</P>
<H3>Implementing the Naming Convention</H3>
<P>The best way to ensure consistency is to <STRONG>script configuration changes</STRONG>.&nbsp; I use PowerShell to tear down and build up my development environment, and I use the same approach to make changes to production servers.&nbsp; In a future post, I will provide a sample, but essentially, I create a script that takes an environment-specific XML configuration file as a parameter.&nbsp; For example: </P>
<P><STRONG>Provision-Farm.ps1 johnpowell.development.xml</STRONG></P>
<P>If you are lucky and brilliant enough to have a naming convention in place before the farm has been configured, it is much easier to implement the database naming convention.&nbsp; Implementing a standard after the fact will require additional steps.&nbsp; So let’s suppose you just installed the SharePoint bits and are ready to configure SharePoint.&nbsp; Stop!&nbsp; Rather than use the GUI, use PSConfig from the command line.&nbsp; This enables you to control the Central Administration content database name.&nbsp; For example, to create the configuration and CA database, use the following command:</P>
<P><STRONG>psconfig.exe -cmd configdb -create –server sqlcluster.aw.com -database</STRONG>&nbsp;<STRONG>SharePoint_AWIntranet_Config -user svc-sp-aw-farm -password </STRONG><A href="mailto:pass@word1" mce_href="mailto:pass@word1"><STRONG>pass@word1</STRONG></A><STRONG> -admincontentdatabase SharePoint_AWIntranet_Content_CA</STRONG></P>
<P>But what if you have an existing farm?&nbsp; In that case, <A href="https://blogs.msdn.com/sgoodyear/archive/2007/12/09/renaming-the-sharepoint-central-administration-content-database-sharepoint-admincontent.aspx" target=_blank mce_href="https://blogs.msdn.com/sgoodyear/archive/2007/12/09/renaming-the-sharepoint-central-administration-content-database-sharepoint-admincontent.aspx">this post</A> describes how to rename the Central Administration content database and <A href="https://blogs.technet.com/wbaer/archive/2008/06/16/renaming-content-databases.aspx" target=_blank mce_href="https://blogs.technet.com/wbaer/archive/2008/06/16/renaming-content-databases.aspx">this post</A> outlines the procedure for renaming other content databases.</P>
<H3>Conclusion</H3>
<P>It is good practice to have a database naming convention, and to define and document it during the planning phase.&nbsp; Although the SharePoint administrative interfaces do not enforce a database naming convention, with a little planning and governance you can implement a standard.&nbsp; Once a standard is defined, scripting configuration changes is the best way to ensure they are implemented consistently.&nbsp; For example, you could have a script <EM>Create-WebApplication.ps1</EM> that takes a few parameters and implements your naming convention.&nbsp; SharePoint 2010 has <EM>significantly</EM> more databases that 2007, making database naming even more important.&nbsp; So here are your “go dos:”</P>
<UL>
<LI>Define and document a database naming standard</LI>
<LI>Create scripts to implement your standards</LI>
<LI>Evaluate existing farms against your standards, and create a plan to rename them</LI></UL>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint 2010 Localization with Visual Studio 2010</title>
      <link>https://docs.microsoft.com/archive/blogs/johnwpowell/sharepoint-2010-localization-with-visual-studio-2010</link>
      <pubDate>Sat, 28 Nov 2009 18:30:00 GMT</pubDate>
      <dc:creator><![CDATA[johnwpowell]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/johnwpowell/2009/11/28/sharepoint-2010-localization-with-visual-studio-2010/</guid>
      <description><![CDATA[In this walkthrough, I’ll show you how to create a SharePoint 2010 localized feature using Visual...]]></description>
      <content:encoded><![CDATA[<P>In this walkthrough, I’ll show you how to create a SharePoint 2010 localized feature using Visual Studio 2010.&nbsp; The basic mechanics of localizing a SharePoint 2010 feature are the same as localizing a SharePoint 2007 feature, and is well documented.&nbsp; If you are unfamiliar with localization in SharePoint, please see Additional Resources at the end of this article.&nbsp; In a nutshell, localized resources are stored in Resources (.resx) files, and in SharePoint exist in one of the following locations:</P>
<UL>
<LI>\14\Template\Features\&lt;Feature Name&gt;\Resources\ </LI>
<LI>\14\Resources\ </LI>
<LI>\14\Config\Resources\ </LI>
<LI>&lt;Virtual Directory&gt;\App_GlobalResources\ (note: resources files from \14\Config\Resources are copied here when provisioned) </LI></UL>
<P>Resources files follow a naming convention that consists of a base name such as “HelloLocalization.resx” and culture-specific resources such as “HelloLocalization.es-ES.resx.”&nbsp; In SharePoint, these files must be in a particular location depending on usage.&nbsp; In this walkthrough, I’ll show you how to create a “centralized” resources files that will be stored in 14\Resources.&nbsp; My preference is to store custom files in as few locations as possible within the SharePoint hive.&nbsp; I have also found that certain resources cannot be accessed from certain locations.&nbsp; So with that in mind, let’s get started:</P>
<P>Since we are deploying to 14\Resources, we need to add a mapped folder.&nbsp; Select <EM>Add &gt; SharePoint Mapped Folder…</EM></P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_2.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_2.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_2.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb.png" width=538 height=500 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb.png"></A> </P>
<P>Select the <EM>Resources</EM> folder:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_6.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_6.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_6.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_2.png" width=370 height=470 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_2.png"></A> </P>
<P>In the solution, delete the subfolder that was created in the Resources folder.&nbsp; Next, right-click on the mapped folder and select <EM>Add New Item</EM>.&nbsp; In the<EM> Search Installed Templates</EM> search box, type <EM>Resources</EM> to select the Resources file template.&nbsp; Rename the resources file to something unique to your feature:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_16.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_16.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_16.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_7.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_7.png" width=244 height=173 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_7.png"></A> </P>
<P>Set the <EM>Build Action</EM> to <EM>Content</EM> for the resources file:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_18.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_18.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_18.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_8.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_8.png" width=642 height=226 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_8.png"></A> </P>
<P>Add your localized strings to the resource file:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_20.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_20.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_20.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_9.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_9.png" width=494 height=167 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_9.png"></A> </P>
<P>For each feature, set the <EM>Default Resource File</EM> to the resource file name.&nbsp; This enables you to reference a resource without fully qualifying it:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_10.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_10.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_10.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_4.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_4.png" width=615 height=123 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_4.png"></A> </P>
<P>Optional: you can hide a feature when localized resources are not available for it by setting the <EM>Require Resources</EM> setting to <EM>True</EM>:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_28.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_28.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_28.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_13.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_13.png" width=474 height=101 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_13.png"></A> </P>
<P>Now you can use the localized strings throughout your feature such as in the feature title and description:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_24.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_24.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_24.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_11.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_11.png" width=660 height=424 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_11.png"></A> </P>
<P>When deployed, the feature appears like this in Site Collection Features:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_26.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_26.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_26.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_12.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_12.png" width=303 height=59 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_12.png"></A> </P>
<P>The resources can also be used in the .webpart file:</P>
<P><SPAN style="COLOR: blue">&lt;?</SPAN><SPAN style="COLOR: #a31515">xml </SPAN><SPAN style="COLOR: red">version</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">1.0</SPAN>" <SPAN style="COLOR: red">encoding</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">utf-8</SPAN>"<SPAN style="COLOR: blue">?&gt; <BR>&lt;</SPAN><SPAN style="COLOR: #a31515">webParts</SPAN><SPAN style="COLOR: blue">&gt; <BR>&nbsp; &lt;</SPAN><SPAN style="COLOR: #a31515">webPart </SPAN><SPAN style="COLOR: red">xmlns</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">https://schemas.microsoft.com/WebPart/v3</SPAN>"<SPAN style="COLOR: blue">&gt; <BR>&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="COLOR: #a31515">metaData</SPAN><SPAN style="COLOR: blue">&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="COLOR: #a31515">type </SPAN><SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">HelloLocalization.LocalizedWebPart.LocalizedWebPart, $SharePoint.Project.AssemblyFullName$</SPAN>" <SPAN style="COLOR: blue">/&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="COLOR: #a31515">importErrorMessage</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>$Resources:core,ImportErrorMessage;<SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">importErrorMessage</SPAN><SPAN style="COLOR: blue">&gt; <BR>&nbsp;&nbsp;&nbsp; &lt;/</SPAN><SPAN style="COLOR: #a31515">metaData</SPAN><SPAN style="COLOR: blue">&gt; <BR>&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="COLOR: #a31515">data</SPAN><SPAN style="COLOR: blue">&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="COLOR: #a31515">properties</SPAN><SPAN style="COLOR: blue">&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="COLOR: #a31515">property </SPAN><SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">Title</SPAN>" <SPAN style="COLOR: red">type</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">string</SPAN>"<SPAN style="COLOR: blue">&gt;</SPAN>$Resources:HelloLocalization,WebPartTitle<SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">property</SPAN><SPAN style="COLOR: blue">&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="COLOR: #a31515">property </SPAN><SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">Description</SPAN>" <SPAN style="COLOR: red">type</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">string</SPAN>"<SPAN style="COLOR: blue">&gt;</SPAN>$Resources:HelloLocalization,WebPartDescription<SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">property</SPAN><SPAN style="COLOR: blue">&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</SPAN><SPAN style="COLOR: #a31515">properties</SPAN><SPAN style="COLOR: blue">&gt; <BR>&nbsp;&nbsp;&nbsp; &lt;/</SPAN><SPAN style="COLOR: #a31515">data</SPAN><SPAN style="COLOR: blue">&gt; <BR>&nbsp; &lt;/</SPAN><SPAN style="COLOR: #a31515">webPart</SPAN><SPAN style="COLOR: blue">&gt; <BR>&lt;/</SPAN><SPAN style="COLOR: #a31515">webParts</SPAN><SPAN style="COLOR: blue">&gt; <BR></SPAN></P><A href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></A>
<P>Which appears like this in the Web Part Gallery:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_34.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_34.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_34.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_16.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_16.png" width=624 height=225 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_16.png"></A> </P>
<P>When you add the web part to a page, it appears like this:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_36.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_36.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_36.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_17.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_17.png" width=660 height=247 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_17.png"></A> </P>
<P>The localized resources can also be used in the web part:</P><PRE class=code><SPAN style="COLOR: blue">protected void </SPAN>Page_Load(<SPAN style="COLOR: blue">object </SPAN>sender, <SPAN style="COLOR: #2b91af">EventArgs </SPAN>e)
{
    <SPAN style="COLOR: blue">var </SPAN>lang = <SPAN style="COLOR: #2b91af">SPContext</SPAN>.Current.Web != <SPAN style="COLOR: blue">null </SPAN>? <SPAN style="COLOR: #2b91af">SPContext</SPAN>.Current.Web.Language : <SPAN style="COLOR: brown">1033</SPAN>;
    webPartMessage.Text = <SPAN style="COLOR: #2b91af">SPUtility</SPAN>.GetLocalizedString(
        <SPAN style="COLOR: #a31515">"$Resources:WebPartMessage"</SPAN>, 
        <SPAN style="COLOR: #a31515">"HelloLocalization"</SPAN>, 
        lang);

}</PRE>
<P>Which appears like this when added to a page:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_38.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_38.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_38.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_18.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_18.png" width=288 height=72 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_18.png"></A> </P>
<P>To support a different culture, copy the resources file, and rename it to [ResourcesFileName].[Culture].resx.&nbsp; For example, to create a Spanish (Spain) resources file:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_44.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_44.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_44.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_21.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_21.png" width=249 height=188 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_21.png"></A> </P>
<P>Make the culture-specific changes to the resources strings:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_42.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_42.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_42.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_20.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_20.png" width=430 height=149 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_20.png"></A> </P>
<P><STRONG>If the language pack is installed</STRONG> on the SharePoint server, and<STRONG> the site has been created using that language</STRONG>, the resources file will be used:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_46.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_46.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_46.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_22.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_22.png" width=303 height=80 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_22.png"></A> </P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_48.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_48.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_48.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_23.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_23.png" width=660 height=208 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_23.png"></A> </P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_50.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_50.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_50.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_24.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_24.png" width=270 height=76 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_24.png"></A> </P>
<P>For completeness, you should also be aware of the Visual Studio 2010 Feature Resources feature.&nbsp; When you select <EM>Add Feature Resource...</EM>:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_30.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_30.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_30.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_14.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_14.png" width=433 height=287 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_14.png"></A> </P>
<P>you are prompted for the culture, and the appropriately named resource file is created automatically:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_32.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_32.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_32.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_15.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_15.png" width=370 height=153 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/SharePoint2010LocalizationwithVisualStud_103D3/image_thumb_15.png"></A> </P>
<H3>Conclusion</H3>
<P>In this walkthrough, I showed you how to localize a SharePoint 2010 feature.&nbsp; Even if you aren’t targeting multiple languages, in my opinion it’s good practice to store resources outside of your compiled code.&nbsp; I hope you found this useful, and your feedback is welcomed!</P>
<H3>Additional Resources</H3>
<UL>
<LI><A href="https://blogs.msdn.com/michael_yeager/archive/2008/02/05/sharepoint-v3-localized-resources.aspx" target=_blank mce_href="https://blogs.msdn.com/michael_yeager/archive/2008/02/05/sharepoint-v3-localized-resources.aspx">SharePoint v3 Localized Resources</A> </LI>
<LI><A href="https://www.intranetjournal.com/articles/200702/ij_02_16_07a.html" target=_blank mce_href="https://www.intranetjournal.com/articles/200702/ij_02_16_07a.html">SharePoint Localization Tips and Tricks</A> </LI>
<LI><A href="https://blogs.msdn.com/maximeb/archive/2008/04/26/deploying-resource-files-across-a-farm.aspx" target=_blank mce_href="https://blogs.msdn.com/maximeb/archive/2008/04/26/deploying-resource-files-across-a-farm.aspx">Deploying resource files across a farm</A> </LI></UL>]]></content:encoded>
    </item>
    <item>
      <title>How to Install SharePoint 2010 On Windows 7</title>
      <link>https://docs.microsoft.com/archive/blogs/johnwpowell/how-to-install-sharepoint-2010-on-windows-7</link>
      <pubDate>Tue, 24 Nov 2009 08:12:00 GMT</pubDate>
      <dc:creator><![CDATA[johnwpowell]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/johnwpowell/2009/11/24/how-to-install-sharepoint-2010-on-windows-7/</guid>
      <description><![CDATA[Here is a high-level overview of the steps required to install SharePoint 2010 (Beta 2) on Windows 7...]]></description>
      <content:encoded><![CDATA[<P>Here is a high-level overview of the steps required to install SharePoint 2010 (Beta 2) on Windows 7 (x64):</P>
<UL>
<LI>Extract / copy SharePoint setup files to your computer</LI>
<LI>Edit files\setup\config.xml and add the AllowWindowsClientInstall = TRUE setting</LI>
<LI>Manually install prerequisites</LI>
<LI>Enable Windows features (via command line)</LI>
<LI>Install SharePoint (standalone), but do not run the configuration wizard</LI>
<LI>Install SQL Server 2008 CU 2</LI>
<LI>Run SharePoint configuration wizard</LI></UL>
<P>Full details can be found on the MSDN article, <A href="https://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx">Setting Up the Development Environment for SharePoint Server</A>.</P>]]></content:encoded>
    </item>
    <item>
      <title>Enable the Developer Dashboard using the Object Model / Powershell</title>
      <link>https://docs.microsoft.com/archive/blogs/johnwpowell/enable-the-developer-dashboard-using-the-object-model-powershell</link>
      <pubDate>Sun, 22 Nov 2009 15:05:00 GMT</pubDate>
      <dc:creator><![CDATA[johnwpowell]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/johnwpowell/2009/11/22/enable-the-developer-dashboard-using-the-object-model-powershell/</guid>
      <description><![CDATA[The SharePoint 2010 developer dashboard has three display levels (see SPDeveloperDashboardLevel...]]></description>
      <content:encoded><![CDATA[<P>The SharePoint 2010 developer dashboard has three display levels (see <A href="https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spdeveloperdashboardlevel(office.14).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spdeveloperdashboardlevel(office.14).aspx">SPDeveloperDashboardLevel Enumeration</A>.):</P>
<UL>
<LI><STRONG>Off</STRONG> (default): The dashboard is not displayed, and there&nbsp;is no UI element to turn it on</LI>
<LI><STRONG>On</STRONG>: The dashboard is displayed, and there&nbsp;is no UI element to turn it off:</LI></UL>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/1_2.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/1_2.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/1_2.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=1 border=0 alt=1 src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/1_thumb.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/1_thumb.png" width=660 height=435 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/1_thumb.png"></A> </P>
<UL>
<LI><STRONG>OnDemand</STRONG>: A UI element enables you to turn it on or off</LI></UL>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/2_2.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/2_2.png" target=_blank mce_href="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/2_2.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=2 border=0 alt=2 src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/2_thumb.png" original-url="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/2_thumb.png" width=514 height=500 mce_src="https://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/EnabletheDeveloperDashboardusingtheObjec_FE57/2_thumb.png"></A> </P>
<P>There are a few ways to set the developer dashboard level.&nbsp; One option is to use stsadm –o setproperty –pn developer-dashboard –pv “On”, but in this article, I’ll show you how to control the dashboard through the object model using PowerShell.&nbsp; </P>
<P>To configure the dashboard, use the <A href="https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebservice.contentservice(office.14).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebservice.contentservice(office.14).aspx">SPWebService.ContentService</A> object to set properties on the <A href="https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spdeveloperdashboardsettings_members(office.14).aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spdeveloperdashboardsettings_members(office.14).aspx">SPDeveloperDashboardSettings</A> class.&nbsp; Here is the PowerShell script to set the level:</P>
<P><SPAN style="COLOR: blue">param</SPAN><SPAN style="COLOR: black">(</SPAN><SPAN style="COLOR: purple">$level </SPAN><SPAN style="COLOR: red">= </SPAN><SPAN style="COLOR: black">$(</SPAN><SPAN style="COLOR: blue">throw </SPAN><SPAN style="COLOR: maroon">"level is required.&nbsp; Level is On, Off or OnDemand"</SPAN><SPAN style="COLOR: black">)) <BR><BR></SPAN><SPAN style="COLOR: green"># import assemblies <BR></SPAN><SPAN style="COLOR: black">[</SPAN><SPAN style="COLOR: teal">void</SPAN><SPAN style="COLOR: black">][</SPAN><SPAN style="COLOR: teal">System.Reflection.Assembly</SPAN><SPAN style="COLOR: black">]::</SPAN><SPAN style="COLOR: #8b4513">LoadWithPartialName</SPAN><SPAN style="COLOR: black">(</SPAN><SPAN style="COLOR: maroon">"Microsoft.SharePoint"</SPAN><SPAN style="COLOR: black">) <BR>[</SPAN><SPAN style="COLOR: teal">void</SPAN><SPAN style="COLOR: black">][</SPAN><SPAN style="COLOR: teal">System.Reflection.Assembly</SPAN><SPAN style="COLOR: black">]::</SPAN><SPAN style="COLOR: #8b4513">LoadWithPartialName</SPAN><SPAN style="COLOR: black">(</SPAN><SPAN style="COLOR: maroon">"Microsoft.SharePoint.Administration"</SPAN><SPAN style="COLOR: black">) <BR><BR></SPAN><SPAN style="COLOR: green"># set the level <BR></SPAN><SPAN style="COLOR: purple">$contentService </SPAN><SPAN style="COLOR: red">= </SPAN><SPAN style="COLOR: black">[</SPAN><SPAN style="COLOR: teal">Microsoft.SharePoint.Administration.SPWebService</SPAN><SPAN style="COLOR: black">]::</SPAN><SPAN style="COLOR: #8b4513">ContentService <BR></SPAN><SPAN style="COLOR: purple">$contentService</SPAN><SPAN style="COLOR: black">.</SPAN><SPAN style="COLOR: #8b4513">DeveloperDashboardSettings</SPAN><SPAN style="COLOR: black">.</SPAN><SPAN style="COLOR: #8b4513">DisplayLevel </SPAN><SPAN style="COLOR: red">= </SPAN><SPAN style="COLOR: black">([</SPAN><SPAN style="COLOR: teal">Enum</SPAN><SPAN style="COLOR: black">]::</SPAN><SPAN style="COLOR: #8b4513">Parse</SPAN><SPAN style="COLOR: black">([</SPAN><SPAN style="COLOR: teal">Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel</SPAN><SPAN style="COLOR: black">], </SPAN><SPAN style="COLOR: purple">$level</SPAN><SPAN style="COLOR: black">)) <BR></SPAN><SPAN style="COLOR: purple">$contentService</SPAN><SPAN style="COLOR: black">.</SPAN><SPAN style="COLOR: #8b4513">DeveloperDashboardSettings</SPAN><SPAN style="COLOR: black">.</SPAN><SPAN style="COLOR: #8b4513">Update</SPAN><SPAN style="COLOR: black">() <BR><BR></SPAN><SPAN style="COLOR: #5f9ea0">Write-Host </SPAN><SPAN style="COLOR: black">(</SPAN><SPAN style="COLOR: maroon">"Developer Dashboard Level: " </SPAN><SPAN style="COLOR: red">+ </SPAN><SPAN style="COLOR: purple">$contentService</SPAN><SPAN style="COLOR: black">.</SPAN><SPAN style="COLOR: #8b4513">DeveloperDashboardSettings</SPAN><SPAN style="COLOR: black">.</SPAN><SPAN style="COLOR: #8b4513">DisplayLevel</SPAN><SPAN style="COLOR: black">)</SPAN></P><A href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></A>
<P>Here is a complimentary script to view the current settings:</P><PRE class=code><SPAN style="COLOR: green"># import assemblies
</SPAN><SPAN style="COLOR: black">[</SPAN><SPAN style="COLOR: teal">void</SPAN><SPAN style="COLOR: black">][</SPAN><SPAN style="COLOR: teal">System.Reflection.Assembly</SPAN><SPAN style="COLOR: black">]::</SPAN><SPAN style="COLOR: #8b4513">LoadWithPartialName</SPAN><SPAN style="COLOR: black">(</SPAN><SPAN style="COLOR: maroon">"Microsoft.SharePoint"</SPAN><SPAN style="COLOR: black">)
[</SPAN><SPAN style="COLOR: teal">void</SPAN><SPAN style="COLOR: black">][</SPAN><SPAN style="COLOR: teal">System.Reflection.Assembly</SPAN><SPAN style="COLOR: black">]::</SPAN><SPAN style="COLOR: #8b4513">LoadWithPartialName</SPAN><SPAN style="COLOR: black">(</SPAN><SPAN style="COLOR: maroon">"Microsoft.SharePoint.Administration"</SPAN><SPAN style="COLOR: black">)

</SPAN><SPAN style="COLOR: green"># get the level
</SPAN><SPAN style="COLOR: purple">$contentService </SPAN><SPAN style="COLOR: red">= </SPAN><SPAN style="COLOR: black">[</SPAN><SPAN style="COLOR: teal">Microsoft.SharePoint.Administration.SPWebService</SPAN><SPAN style="COLOR: black">]::</SPAN><SPAN style="COLOR: #8b4513">ContentService
</SPAN><SPAN style="COLOR: #5f9ea0">Write-Host </SPAN><SPAN style="COLOR: purple">$contentService</SPAN><SPAN style="COLOR: black">.</SPAN><SPAN style="COLOR: #8b4513">DeveloperDashboardSettings</SPAN><SPAN style="COLOR: black">.</SPAN><SPAN style="COLOR: #8b4513">DisplayLevel</SPAN></PRE><A href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></A>]]></content:encoded>
    </item>
    <item>
      <title>Visual Studio Extensions for Windows SharePoint Services (VSEWSS) Error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information</title>
      <link>https://docs.microsoft.com/archive/blogs/johnwpowell/visual-studio-extensions-for-windows-sharepoint-services-vsewss-error-unable-to-load-one-or-more-of-the-requested-types-retrieve-the-loaderexceptions-property-for-more-information</link>
      <pubDate>Sun, 16 Aug 2009 10:10:00 GMT</pubDate>
      <dc:creator><![CDATA[johnwpowell]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/johnwpowell/2009/08/16/visual-studio-extensions-for-windows-sharepoint-services-vsewss-error-unable-to-load-one-or-more-of-the-requested-types-retrieve-the-loaderexceptions-property-for-more-information/</guid>
      <description><![CDATA[One error you may see when packaging solutions with VSEWSS is:&nbsp;...]]></description>
      <content:encoded><![CDATA[<P>One error you may see when packaging solutions with VSEWSS is:&nbsp; <EM>Microsoft.SharePoint.Tools.Utilities.VSeWSSServiceException VSeWSS Service Error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.&nbsp; </EM>Like most error messages from VSEWSS, there is not enough information provided to resolve the issue, so I hope to save you some time by providing a workaround that will permanently fix this problem.&nbsp; </P>
<P>When VSEWSS packages your solution, it uses reflection to enumerate the packaged assemblies.&nbsp; It works fine until it encounters an assembly that implements an interface that is defined in another assembly as is often the case in the Microsoft.Practices.* assemblies.&nbsp; I am unsure of exactly why, but the extensions are unable to resolve the dependent assemblies.&nbsp; To work around the issue, you can copy the dependent assemblies to the GAC, but I don’t think this is the optimal solution and doing so will cause pain during development and debugging.&nbsp; Another option is to copy the dependent assemblies to the VSEWSS service bin directory post build.&nbsp; After trying this for awhile, and maintaining the script, I decided it would be much simpler to just copy all assemblies in my solution to the VSEWSS service bin directory on post build.&nbsp; Here is the script:</P><PRE class=csharpcode>@<SPAN class=kwrd>rem</SPAN>======================================================================
@<SPAN class=rem>rem</SPAN>
@<SPAN class=rem>rem    This script copies assemblies to the VSEWSS bin directory</SPAN>
@<SPAN class=rem>rem    to eliminate the packaging type load exception that occurs</SPAN>
@<SPAN class=rem>rem    when an interface is defined in a separate assembly.</SPAN>
@<SPAN class=rem>rem    </SPAN>
@<SPAN class=rem>rem    usage call $(ProjectDir)Scripts/CopyAssembliesToVSEWSSBin.bat $(TargetDir)</SPAN>
@<SPAN class=rem>rem</SPAN>
@<SPAN class=kwrd>rem</SPAN>======================================================================

@echo off

@echo ========== Locating VSEWSS bin directory ==========
@<SPAN class=kwrd>set</SPAN> vsewssbin=%programfiles%\Microsoft SharePoint Developer Tools 9.0\svc\bin
<SPAN class=kwrd>if</SPAN> <SPAN class=kwrd>not</SPAN> exist <SPAN class=str>"%vsewssbin%"</SPAN> <SPAN class=kwrd>set</SPAN> vsewssbin=%ProgramW6432%\Microsoft SharePoint Developer Tools 9.0\svc\bin
@echo VSEWSS bin: %vsewssbin%

@echo ========== Copying assemblies <SPAN class=kwrd>to</SPAN> VSEWSS bin directory ==========
@xcopy <SPAN class=str>"%1*.dll"</SPAN> <SPAN class=str>"%vsewssbin%"</SPAN> /R /Y

</PRE>
<P>To use the script, create a bat file in your project and call it from a post build event. It does take 64-bit installations into account, and it will also work on your Team Build server.</P>]]></content:encoded>
    </item>
  </channel>
</rss>