<?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>Jonathon's SharePoint Notes</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/jfrost/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/jfrost/feed.xml</link>
    <description>Ideas, Code Samples, and Thoughts on Development on the SharePoint Technologies Platform</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:41:27 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Setting Custom Expiration Programmatically</title>
      <link>https://docs.microsoft.com/archive/blogs/jfrost/setting-custom-expiration-programmatically</link>
      <pubDate>Tue, 15 Mar 2011 19:12:57 GMT</pubDate>
      <dc:creator><![CDATA[Jonathon J. Frost]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfrost/2011/03/15/setting-custom-expiration-programmatically/</guid>
      <description><![CDATA[A cool feature in SharePoint 2010 that I’ve been working with for a little while is custom...]]></description>
      <content:encoded><![CDATA[<p>A cool feature in SharePoint 2010 that I’ve been working with for a little while is custom expiration.&#160; SharePoint 2010 gives a few neat options for extending the out-of-box expiration engine to allow custom expiration date calculations and processing actions.</p>  <p>There are a number of good articles out there on how to set custom date calculation formulas and processing actions, however, the challenge I faced was once you have your custom expiration formula and action created, how does one go about setting it programmatically?</p>  <p>The following table has links to some good articles on how to create your own custom expiration formulas and custom actions. Although all of these articles show examples using SharePoint 2007, the same code and APIs apply just the same in SharePoint 2010.</p>  <table border="1" cellspacing="5" cellpadding="5" width="804"><tbody>     <tr>       <td valign="top" width="168"><strong>Custom expiration formula</strong></td>        <td valign="top" width="619"><a href="https://blah.winsmarts.com/2008-10-Authoring_custom_expiration_policies_and_actions_in_SharePoint_2007.aspx" target="_new">https://blah.winsmarts.com/2008-10-Authoring_custom_expiration_policies_and_actions_in_SharePoint_2007.aspx</a></td>     </tr>      <tr>       <td valign="top" width="168"><strong>Custom expiration formula</strong></td>        <td valign="top" width="619"><a href="https://msdn.microsoft.com/en-us/library/cc453774(v=office.12).aspx" target="_new">https://msdn.microsoft.com/en-us/library/cc453774(v=office.12).aspx</a></td>     </tr>      <tr>       <td valign="top" width="168"><strong>Custom expiration action</strong></td>        <td valign="top" width="619"><a href="https://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?List=70640fe5%2D28d9%2D464f%2Db1c9%2D91e07c8f7e47&amp;ID=25" target="_new">https://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?List=70640fe5%2D28d9%2D464f%2Db1c9%2D91e07c8f7e47&amp;ID=25            <br /></a></td>     </tr>   </tbody></table>  <p>For some background, there are two main options for setting expiration in SharePoint 2010. The first is the traditional way that has been around since 2007 that includes attaching an information policy on a content type. The second way is a new way in 2010 that allows the user to set an information policy directly on a list that will override any polices set on content types through was is called in the UI “Library &amp; Folders” level expiration.</p>  <p>In my scenario, I need to set both a custom expiration formula and custom action on a newly created list and only on that list regardless of the content types used in that list. Therefore I need to use the second approach above, applying the information policy directly on the list level.</p>  <p>The following screen shot shows what the admin UI would look like after setting the policy:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/31/34/metablogapi/5732.image_20D81611.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-31-34-metablogapi/5732.image_5F00_20D81611.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/31/34/metablogapi/7380.image_thumb_4E298614.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-31-34-metablogapi/7380.image_5F00_thumb_5F00_4E298614.png" width="792" height="488" /></a></p>  <p>What I found was the key to doing this programmatically is a class named “ListPolicySettings” this class is located in the following DLL and namespace:</p>  <table border="1" cellspacing="3" cellpadding="3" width="822"><tbody>     <tr>       <td valign="top" width="141"><strong>Assembly</strong></td>        <td valign="top" width="670">Microsoft.Office.Policy.dll</td>     </tr>      <tr>       <td valign="top" width="141"><strong>Assembly Location</strong></td>        <td valign="top" width="670">&lt;14 Hive&gt;\ISAPI\</td>     </tr>      <tr>       <td valign="top" width="141"><strong>Namespace</strong></td>        <td valign="top" width="670">Namespace: Microsoft.Office.RecordsManagement.InformationPolicy</td>     </tr>   </tbody></table>  <p>The following is a code sample of this class in action: </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:a5bbb61b-1215-4521-9d0b-653228e88231" 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; max-height: 400px; overflow: auto"> <ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"> <li><span style="color:#2b91af">SPList</span> targetList = targetWeb.Lists[targetListId];</li> <li style="background: #f3f3f3">&nbsp;</li> <li><span style="color:#2b91af">ListPolicySettings</span> retentionPolicy = <span style="color:#0000ff">new</span> <span style="color:#2b91af">ListPolicySettings</span>(targetList);</li> <li style="background: #f3f3f3">&nbsp;</li> <li><span style="color:#0000ff">string</span> retentionXml2 = <span style="color:#a31515">&quot;&lt;Schedules nextStageId=&#92;&quot;3&#92;&quot;&gt;&quot;</span> +</li> <li style="background: #f3f3f3">    <span style="color:#a31515">&quot;&lt;Schedule type=&#92;&quot;Default&#92;&quot;&gt;&quot;</span> +</li> <li>    <span style="color:#a31515">&quot;&lt;stages&gt;&quot;</span> +</li> <li style="background: #f3f3f3">    <span style="color:#a31515">&quot;&lt;data stageId=&#92;&quot;1&#92;&quot; stageDeleted=&#92;&quot;true&#92;&quot; /&gt;&quot;</span> +</li> <li>    <span style="color:#a31515">&quot;&lt;data stageId=&#92;&quot;2&#92;&quot; recur=&#92;&quot;true&#92;&quot; offset=&#92;&quot;1&#92;&quot; unit=&#92;&quot;days&#92;&quot;&gt;&quot;</span> +</li> <li style="background: #f3f3f3">    <span style="color:#a31515">&quot;&lt;formula id=&#92;&quot;CustomExpiration.CustomExpirationFormula&#92;&quot; /&gt;&quot;</span> +</li> <li>    <span style="color:#a31515">&quot;&lt;action type=&#92;&quot;action&#92;&quot; id=&#92;&quot;CustomExpiration.CustomExpirationAction&#92;&quot; /&gt;&quot;</span> +</li> <li style="background: #f3f3f3">    <span style="color:#a31515">&quot;&lt;/data&gt;&quot;</span> +</li> <li>    <span style="color:#a31515">&quot;&lt;/stages&gt;&quot;</span> +</li> <li style="background: #f3f3f3">    <span style="color:#a31515">&quot;&lt;/Schedule&gt;&quot;</span> +</li> <li>    <span style="color:#a31515">&quot;&lt;/Schedules&gt;&quot;</span>;</li> <li style="background: #f3f3f3">&nbsp;</li> <li>retentionPolicy.UseListPolicy = <span style="color:#0000ff">true</span>;</li> <li style="background: #f3f3f3">retentionPolicy.SetRetentionSchedule(retentionXml2, <span style="color:#a31515">&quot;Test from ER&quot;</span>);</li> <li>retentionPolicy.Update();</li> </ol> </div> </div> </div>  <p>In this example above I am setting a retention stage with a custom expiration formula and custom expiration action that also reoccurs with an interval of 1 day.</p>  <p>The key method above is the “SetRetentionSchedule()” method off the ListPolicySettings class. It takes two parameters, an SPList (pretty straight forward) but the second is the RetentionXML block – this is where it got a little tricky.&#160; I could not find much documentation on this class or method, so in order to figure out the XML schema I used a combination of reflector and also used the following code sample to write a little console app to just snag the XML from an existing list where I set the retention schedule information via the user interface.</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:13384b2b-ea27-4b53-9534-3cdd877b8cee" 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; max-height: 300px; overflow: auto"> <ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"> <li><span style="color:#2b91af">SPList</span> targetList = site.RootWeb.Lists[listName];</li> <li style="background: #f3f3f3">&nbsp;</li> <li><span style="color:#2b91af">ListPolicySettings</span> retentionPolicy = <span style="color:#0000ff">new</span> <span style="color:#2b91af">ListPolicySettings</span>(targetList);</li> <li style="background: #f3f3f3">&nbsp;</li> <li><span style="color:#0000ff">string</span> currentPolicyXml = retentionPolicy.GetRetentionSchedule(<span style="color:#a31515">&quot;/DL1&quot;</span>);</li> </ol> </div> </div> </div>  <p>By setting the retention schedule information a few different times with different combinations and seeing how the XML changed, I got a feel for how the XML schema was constructed.</p>  <p>Here one more example from my exploratory session on this:</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:c3615019-3b83-4086-951a-64f801a07241" 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; max-height: 400px; overflow: auto"> <ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"> <li><span style="color:#0000ff">string</span> retentionXml = <span style="color:#a31515">&quot;&lt;Schedules nextStageId=&#92;&quot;2&#92;&quot;&gt;&quot;</span> +</li> <li style="background: #f3f3f3">                <span style="color:#a31515">&quot;&lt;Schedule type=&#92;&quot;Default&#92;&quot;&gt;&quot;</span> +</li> <li>                <span style="color:#a31515">&quot;&lt;stages&gt;&quot;</span> +</li> <li style="background: #f3f3f3">                <span style="color:#a31515">&quot;&lt;data stageId=&#92;&quot;1&#92;&quot;&gt;&quot;</span> +</li> <li>                <span style="color:#a31515">&quot;&lt;formula id=&#92;&quot;Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration.Formula.BuiltIn&#92;&quot;&gt;&quot;</span> +</li> <li style="background: #f3f3f3">                <span style="color:#a31515">&quot;&lt;number&gt;18&lt;/number&gt;&quot;</span> +</li> <li>                <span style="color:#a31515">&quot;&lt;property&gt;Modified&lt;/property&gt;&quot;</span> +</li> <li style="background: #f3f3f3">                <span style="color:#a31515">&quot;&lt;propertyId&gt;28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f&lt;/propertyId&gt;&quot;</span> +</li> <li>                <span style="color:#a31515">&quot;&lt;period&gt;years&lt;/period&gt;&quot;</span> +</li> <li style="background: #f3f3f3">                <span style="color:#a31515">&quot;&lt;/formula&gt;&quot;</span> +</li> <li>                <span style="color:#a31515">&quot;&lt;action type=&#92;&quot;action&#92;&quot; id=&#92;&quot;Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration.Action.Delete&#92;&quot; /&gt;&quot;</span> +</li> <li style="background: #f3f3f3">                <span style="color:#a31515">&quot;&lt;/data&gt;&quot;</span> +</li> <li>                <span style="color:#a31515">&quot;&lt;/stages&gt;&quot;</span> +</li> <li style="background: #f3f3f3">                <span style="color:#a31515">&quot;&lt;/Schedule&gt;&quot;</span> +</li> <li>                <span style="color:#a31515">&quot;&lt;/Schedules&gt;&quot;</span>;</li> </ol> </div> </div> </div>  <p>In this example above I am using the OOB expiration formula and using the Modified Date column as the trigger date plus 18 years.&#160; For the action, I am using the OOB permanent delete action.</p>  <p>I hope that with the examples above, this is enough to help you out if you are in the same scenario I was in in trying to figure how to apply a policy directly on a list programmatically!</p>]]></content:encoded>
    </item>
    <item>
      <title>How to Display a SharePoint Dialog from Ribbon Button and Get Selected Item Context</title>
      <link>https://docs.microsoft.com/archive/blogs/jfrost/how-to-display-a-sharepoint-dialog-from-ribbon-button-and-get-selected-item-context</link>
      <pubDate>Sun, 08 Nov 2009 20:24:09 GMT</pubDate>
      <dc:creator><![CDATA[Jonathon J. Frost]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfrost/2009/11/08/how-to-display-a-sharepoint-dialog-from-ribbon-button-and-get-selected-item-context/</guid>
      <description><![CDATA[Overview  Another really cool new feature in SharePoint 2010 is the new dialog framework provided...]]></description>
      <content:encoded><![CDATA[<h2><strong></strong></h2>  <h2><strong>Overview</strong></h2>  <p>Another really cool new feature in SharePoint 2010 is the new dialog framework provided by the JavaScript client object model.&#160; Inside the new client object model is a JavaScript static class called “<strong>SP.UI.ModalDialog</strong>” that provides a number of helpful methods for working with the dialog framework.&#160; In this blog post, I will discuss the process for displaying a SharePoint Dialog using the client object model and wiring it up to a custom ribbon button and also showing how to get context to selected items in a list or library at the time the ribbon button was clicked.</p>  <p>Before I proceed I really must give a shout out to my colleague Elisabeth Olson at Microsoft.&#160; Thanks to her awesome demos and presentations from recent events and conferences, I got a great head start on learning how the client-side dialoging object model worked.</p>  <p>Also I need to mention that I am using version <strong>14.0.4605.1000</strong> of SharePoint 2010, this version is newer than Beta 1 but not quite full Beta 2.&#160; I am hoping that as we get closer to RTM, upcoming versions still work with my examples in this post.&#160; If you do encounter any weirdness with the samples shown here, please let me know by leaving a comment on this post and I will do my best to investigate and see what’s up.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image_2.png" original-url="https://blogs.msdn.com/blogfiles/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image_2.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image_thumb.png" width="600" height="537" /></a></p>  <p align="center"><em>Screen shot showing the dialog framework in action for edit list item properties. It’s draggable too!</em></p>  <p>&#160;</p>  <p>&#160;</p>  <h2><strong>Looking at &quot;SP.UI.ModalDialog.showModalDialog()&quot;</strong></h2>  <p>The method in the <strong>SP.UI.ModalDialog</strong> class that launches the dialog is <strong>SP.UI.ModalDialog.showModalDialog() </strong>and it takes a parameter of an object called “<strong>options</strong>”.&#160; The “<strong>options</strong>” parameter is really quite important because it communicates to the dialog all the settings for it such as the URL to be displayed inside the dialog, its dimensions and other settings.&#160; The pattern I’ve used and seen so far is just to declare a literal object called “<strong>options</strong>”<strong> </strong>(could be any name you like though of course) with the correct members specified, then pass this object along to “<strong>showModalDialog()</strong>”.&#160; To see this in action, check out the custom ribbon button code sample below.&#160; In this code we are defining the the properties of a custom ribbon button.&#160; It is inside the “<strong>CommandAction</strong>” attribute that is inside the “<strong>CommandUIHandler</strong>” that we specify the JavaScript that is executed when the button is clicked.&#160; In our case, we are launching a dialog.&#160; If you would like to learn more about adding a custom button to the SharePoint 2010 ribbon, I have a <a href="https://blogs.msdn.com/jfrost/archive/2009/11/06/adding-custom-button-to-the-sharepoint-2010-ribbon.aspx" target="_blank">recent blog post on this topic</a>.</p>  <p>I should also mention that in order for the dialog to be completely useful, you will need to deploy a custom page such as an application page first to your SharePoint web application that you can use to render in your dialog.</p>  <p>Something else cool to mention is that you may notice that OOB in SharePoint the pages in the dialogs seem to have some smartness with their masterpage chrome.&#160; It turns out that now in SharePoint 2010, masterpages won’t show all the top and left nav stuff if they are being displayed inside a dialog launched using the <strong>showModalDialog()</strong> function.&#160; The masterpages do this because now if any content in SharePoint is marked up using the CSS class “<strong>s4-notdlg</strong>” it will render when viewed normally in a browser, but when rendered through a client object modal dialog, the content marked with this CSS class will not be displayed.</p>  <p>One last side note to point out is that because the “<strong>showModalDialog()</strong>” function is simply part of the SharePoint 2010 client object model we could actually call it from anywhere, such as a context menu item click or a button on the screen, it doesn’t necessarily have to be a custom ribbon button.&#160; But I am suspecting that launching dialogs from custom ribbon buttons might be a pretty common pattern as more custom applications are written on SharePoint 2010.</p>  <p>&#160;</p>  <p></p>  <p></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:714b41a4-8ae2-4a2a-a5e6-65393b8bdbaa" 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; max-height: 500px; overflow: auto"> <ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"> <li><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Elements</span><span style="color:#0000ff"> </span><span style="color:#ff0000">xmlns</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">https://schemas.microsoft.com/sharepoint/</span>&quot;<span style="color:#0000ff">&gt;</span></li> <li style="background: #f3f3f3">&nbsp;</li> <li>&#160;&#160;<span style="color:#0000ff">&lt;</span><span style="color:#a31515">CustomAction</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span></li> <li>&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Id</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">SkynetCustomRibbonButton</span>&quot;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">RegistrationId</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">101</span>&quot;</li> <li>&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">RegistrationType</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">List</span>&quot;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Location</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">CommandUI.Ribbon</span>&quot;</li> <li>&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Sequence</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">5</span>&quot;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Title</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">Move Documents</span>&quot;<span style="color:#0000ff">&gt;</span></li> <li>&nbsp;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;<span style="color:#0000ff">&lt;</span><span style="color:#a31515">CommandUIExtension</span><span style="color:#0000ff">&gt;</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">&lt;</span><span style="color:#a31515">CommandUIDefinitions</span><span style="color:#0000ff">&gt;</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">&lt;</span><span style="color:#a31515">CommandUIDefinition</span><span style="color:#0000ff"> </span><span style="color:#ff0000">Location</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">Ribbon.Documents.Manage.Controls._children</span>&quot;<span style="color:#0000ff">&gt;</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Id</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">Ribbon.Documents.New.SkynetTestButton</span>&quot;</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Alt</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">Move Documents</span>&quot;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Sequence</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">5</span>&quot;</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Command</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">Skynet_Test_Button</span>&quot;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Image32by32</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">/_layouts/images/Skynet/WinEarth32x32.png</span>&quot;</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Image16by16</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">/_layouts/images/Skynet/WinEarth16x16.png</span>&quot;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">LabelText</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">Move Documents</span>&quot;</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">TemplateAlias</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">o1</span>&quot;<span style="color:#0000ff"> /&gt;</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">&lt;/</span><span style="color:#a31515">CommandUIDefinition</span><span style="color:#0000ff">&gt;</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">&lt;/</span><span style="color:#a31515">CommandUIDefinitions</span><span style="color:#0000ff">&gt;</span></li> <li style="background: #f3f3f3">&nbsp;</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">&lt;</span><span style="color:#a31515">CommandUIHandlers</span><span style="color:#0000ff">&gt;</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">&lt;</span><span style="color:#a31515">CommandUIHandler</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">Command</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">Skynet_Test_Button</span>&quot;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span><span style="color:#ff0000">CommandAction</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">javascript:</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">function demoCallback(dialogResult, returnValue)</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">{</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">SP.UI.Notify.addNotification(&#39;Operation Successful!&#39;);</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">}</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">var ctx = SP.ClientContext.get_current();</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">var items = SP.ListOperation.Selection.getSelectedItems(ctx);</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">var myItems = &#39;&#39;;</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">var k;</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">for (k in items)</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">{</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">myItems += &#39;|&#39; + items[k].id;</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">}</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">var options = {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">url: &#39;/_layouts/Skynet/ShowItems.aspx?items=&#39; + myItems + &#39;</span><span style="color:#ff0000">&amp;amp;</span><span style="color:#0000ff">source=&#39; + SP.ListOperation.Selection.getSelectedList(),</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">tite: &#39;Move Documents&#39;,</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">allowMaximize: false,</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">showClose: false,</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">width: 800,</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">height: 600,</span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">dialogReturnValueCallback: demoCallback };</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">SP.UI.ModalDialog.showModalDialog(options);</span>&quot;<span style="color:#0000ff"> /&gt;</span></li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff"></span></li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">&lt;/</span><span style="color:#a31515">CommandUIHandlers</span><span style="color:#0000ff">&gt;</span></li> <li>&nbsp;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;<span style="color:#0000ff">&lt;/</span><span style="color:#a31515">CommandUIExtension</span><span style="color:#0000ff">&gt;</span></li> <li>&#160;&#160;<span style="color:#0000ff">&lt;/</span><span style="color:#a31515">CustomAction</span><span style="color:#0000ff">&gt;</span></li> <li style="background: #f3f3f3">&#160;&#160;<span style="color:#0000ff"></span></li> <li><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Elements</span><span style="color:#0000ff">&gt;</span></li> </ol> </div> </div> </div>  <h2>&#160;</h2>  <h2><strong></strong></h2>  <h2><strong>Code Analysis</strong></h2>  <p>To delve a little deeper into the code sample above, on line 39 we are declaring our literal object called “<strong>options</strong>” that we create along with the required members.&#160; The code above covers a number of all the possible fields available to be used in the option class, but there are a few more too.&#160; If you are curious, and would like to dig in further to see all the possible fields for the options object, and how the options object is parsed inside the <strong>showModalDialog()</strong> function, check out the .js file named “<strong>SP.UI.Dialog.debug.js</strong>” located in the folder “<strong>{14 Hive}\TEMPLATE\LAYOUTS\</strong>” – on lines 24 to 93 you can see the actual code that is processing this object.</p>  <p>One of the members of the options object that is, I think, particularly important to point out is “<strong>dialogReturnValueCallback</strong>”.&#160; This field takes a user defined delegate function which subsequently will be called after the dialog is closed.&#160; This could be useful for a lot of reasons, one I’ve already ran into is wanting to refresh the originating list or library if the dialog is doing something that updates the items.&#160; Also, another cool new feature of the SharePoint 2010 client object mode and good use for the callback function is a function called “<strong>SP.UI.Notify.addNotification()</strong>”.&#160; This function is shown in my “<strong>demoCallback</strong>” delegate function above and when called displays a friendly, subtly fading message on the top right of the screen.&#160; This is an attractive way to display some kind of feedback to an end user after the dialog is closed.</p>  <p>I mentioned refreshing the list as a reason to use the callback function.&#160; The function I found for doing this (after digging around in the OOB .js files for inspiration) is “<strong>SP.UI.ModalDialog.RefreshPage()</strong>”.&#160; RefreshPage takes a couple of different parameters, but the one that I found works best to gracefully refresh the list without a full postback was to use the built-in enumeration of “<strong>SP.UI.DialogResult.OK</strong>” as seen above on line 36.</p>  <h2>&#160;</h2>  <h2><strong></strong></h2>  <h2><strong>Getting Selected Item Context</strong></h2>  <p>The other big concept illustrated in the code sample above is getting context on the items selected in the list or library the user launched the dialog from.&#160; This was something that took me a little while to figure out because I could not find too many examples of it yet.&#160; In the end I actually ended up interrogating the OOB features of “Document Sets” and “In Place Records Management” to see inside their .js files how they accomplished getting item context when their dialogs are launched.</p>  <p>The key function I found I needed to use was “<strong>getSelectedItems()</strong>”, as shown on line 40 in the <em>above</em> code sample, which lives in the static JavaScript class “<strong>SP.ListOperation.Selection</strong>”.&#160; This function takes in a context object so first I had to get context using the <strong>“SP.ClientContext.get_current()</strong>” function then pass the resulting object as the single parameter of “<strong>getSelectedItems()</strong>”.&#160; The function “<strong>getSelectedItems()</strong>” then returns a loosely typed collection object (well, everything is loosely typed in JavaScript!) of the selected items in the list or library that I then iterate through using a “for” loop, where in each iteration of the loop I snag the ID of the item and build up a string of all the IDs using a pipe symbol as a delimiter (this will come in handy shortly).</p>  <p>From there, on line 50 in the <em>above</em> code sample, I append query string parameters onto my URL field of my options object of the built-up string of IDs, delimited with pipe symbols, and also the ID GUID of the current list.&#160; The key reason for employing the query string for this, as I am sure you’ve guessed by now, is that on my ShowItems.aspx application page, I parse these query string parameters server-side, performing a <strong>string.Split(‘|’)</strong> call on the string of IDs and using the ID GUID of the list to get context of the items that were selected client-side.&#160; Once you get to this point, your options are endless with our old friend the SharePoint server-side API.&#160; The code sample <em>below</em> is from the code behind of my ShowItems.aspx application page and illustrates the server-side aspect discussed:</p>  <p>&#160;</p>  <p></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:f627394b-5917-4dbb-9409-ed067189355b" 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; max-height: 500px; overflow: auto"> <ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"> <li><span style="color:#0000ff">using</span> System;</li> <li style="background: #f3f3f3"><span style="color:#0000ff">using</span> System.Web;</li> <li><span style="color:#0000ff">using</span> System.Web.UI;</li> <li style="background: #f3f3f3"><span style="color:#0000ff">using</span> System.Web.UI.WebControls;</li> <li><span style="color:#0000ff">using</span> System.Collections.Generic;</li> <li style="background: #f3f3f3"><span style="color:#0000ff">using</span> Microsoft.SharePoint;</li> <li><span style="color:#0000ff">using</span> Microsoft.SharePoint.Client;</li> <li style="background: #f3f3f3"><span style="color:#0000ff">using</span> Microsoft.SharePoint.WebControls;</li> <li>&nbsp;</li> <li style="background: #f3f3f3"><span style="color:#0000ff">namespace</span> Skynet.CustomRibbonButton</li> <li>{</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;<span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">DemoPage</span> : <span style="color:#2b91af">LayoutsPageBase</span></li> <li>&#160;&#160;&#160;&#160;{</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">protected</span> <span style="color:#2b91af">Label</span> LabelItems;</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">protected</span> <span style="color:#2b91af">TextBox</span> TextDestination;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">protected</span> System.Collections.Generic.<span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">SPListItem</span>&gt; ListItems;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#0000ff">void</span> OnLoad(<span style="color:#2b91af">EventArgs</span> e)</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">if</span> (Request.QueryString[<span style="color:#a31515">&quot;items&quot;</span>] != <span style="color:#0000ff">null</span> &amp;&amp; Request.QueryString[<span style="color:#a31515">&quot;source&quot;</span>] != <span style="color:#0000ff">null</span>)</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">string</span> source = Request.QueryString[<span style="color:#a31515">&quot;source&quot;</span>];</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">string</span>[] items = Request.QueryString[<span style="color:#a31515">&quot;items&quot;</span>].ToString().Split(<span style="color:#a31515">&#39;|&#39;</span>);</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;LabelItems.Text = <span style="color:#a31515">&quot;You have selected the following items to move:&lt;br&gt;&lt;br&gt;&quot;</span>;</li> <li>&nbsp;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;source = source.Substring(1, source.Length - 2).ToLower();</li> <li>&nbsp;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#2b91af">Guid</span> sourceID = <span style="color:#0000ff">new</span> <span style="color:#2b91af">Guid</span>(source);</li> <li>&nbsp;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#2b91af">SPDocumentLibrary</span> sourceDocLib = (<span style="color:#2b91af">SPDocumentLibrary</span>)<span style="color:#2b91af">SPContext</span>.Current.Web.Lists[sourceID];</li> <li>&nbsp;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ListItems = <span style="color:#0000ff">new</span> System.Collections.Generic.<span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">SPListItem</span>&gt;();</li> <li>&nbsp;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 1; i &lt; items.Length; i++)</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#2b91af">SPListItem</span> currentListItem = sourceDocLib.GetItemById(<span style="color:#0000ff">int</span>.Parse(items[i]));</li> <li>&nbsp;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ListItems.Add(currentListItem);</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;LabelItems.Text += currentListItem.Name + <span style="color:#a31515">&quot;&lt;br&gt;&quot;</span>;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}</li> <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}</li> <li>&nbsp;</li> <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#008000">// more stuff here, omitted for simplicity</span></li> <li>&#160;&#160;&#160;&#160;}</li> <li style="background: #f3f3f3">}</li> </ol> </div> </div> </div>  <p></p>  <p></p>  <h2><strong></strong></h2>  <h2><strong>Some Further Visuals</strong></h2>  <p>After you add the the <strong>CommandAction</strong> code as shown in the code sample above and redeploy your feature, you can have a dialog appear that looks like the following below.&#160; As you can see we are hiding the maximize button and close button as specified in the options object, along with rendering the custom application page as the URL value.&#160; Also, due to getting context of the selected items from the originating library, I am then rendering the names of the files on the server-side code, using the IDs of each item to get context to the actual <strong>SPListItem</strong> object.</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image22.png" original-url="https://blogs.msdn.com/blogfiles/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image22.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image22_thumb.png" original-url="https://blogs.msdn.com/blogfiles/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image22_thumb.png" width="804" height="621" /></a></p>  <p>&#160;</p>  <p>As mentioned earlier, below is an example of what happens when you close the dialog.&#160; Because we make a call to “<strong>SP.UI.Notify.addNotification()</strong>” on the callback function delegate, the attractive yellow message appears on the top right of the page.</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image17.png" original-url="https://blogs.msdn.com/blogfiles/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image17.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image17_thumb.png" original-url="https://blogs.msdn.com/blogfiles/jfrost/WindowsLiveWriter/HowtoDisplayaSharePointDialogfromRibbonB_F66E/image17_thumb.png" width="804" height="500" /></a></p>  <p>&#160;</p>  <p>Well that’s it for now.&#160; I hope to be posting more on the topic of the dialog framework and the SharePoint 2010 client object model overall since I find these topics really interesting and also because I am working with them for my current project and it’s nice to keep track of what I’ve been working on for future reference.</p>]]></content:encoded>
    </item>
    <item>
      <title>Adding Custom Button to the SharePoint 2010 Ribbon</title>
      <link>https://docs.microsoft.com/archive/blogs/jfrost/adding-custom-button-to-the-sharepoint-2010-ribbon</link>
      <pubDate>Fri, 06 Nov 2009 18:37:31 GMT</pubDate>
      <dc:creator><![CDATA[Jonathon J. Frost]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfrost/2009/11/06/adding-custom-button-to-the-sharepoint-2010-ribbon/</guid>
      <description><![CDATA[In this blog post I will walk through how to add a custom button to the new SharePoint 2010...]]></description>
      <content:encoded><![CDATA[<p>In this blog post I will walk through how to add a custom button to the new SharePoint 2010 ribbon.&#160; One very big and noticeable update in SharePoint 2010 is that we now have an awesome, Office client-like ribbon the provides most of the controls and buttons now in SharePoint 2010.&#160; A question that has come up on my current project is, how can we add new buttons to it that do cool stuff, like popup dialogs and so forth?&#160; In this post I will walk through just adding a custom button, but in an upcoming post I will walk through how to make a popup dialog render when a custom button is clicked.</p>  <p>For reference, the version of SharePoint 2010 I am using is <strong>14.0.4605.1000</strong>.&#160; This version is newer than Beta 1 (also called Technical Preview) but not quite full Beta 2.&#160; So I unfortunately can’t guaranty that these steps will work in full Beta 2 or RTM.&#160; But nevertheless, I hope the process I use and my notes along the way can be useful!</p>  <p><strong>Step 1: Create Feature Definition File</strong></p>  <p>The first step to adding a custom button is to create a new feature definition file.&#160; This schema has changed very little since SharePoint 2007.&#160; In fact, I have been using old SharePoint 2007 samples as my base and not changing anything and they work great!</p>  <p></p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px">   <div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid">     <div style="padding-bottom: 2px; padding-left: 5px; padding-right: 5px; font-family: verdana, tahoma, arial, sans-serif; background: #000080; color: #fff; font-weight: bold; padding-top: 2px">Code Snippet</div>      <div style="background: #ddd; overflow: auto">       <ol style="padding-bottom: 0px; margin: 0px 0px 0px 2.5em; padding-left: 5px; padding-right: 0px; background: #ffffff; padding-top: 0px">         <li><span style="color: #0000ff">&lt;</span><span style="color: #a31515">Feature</span><span style="color: #0000ff"> </span><span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">https://schemas.microsoft.com/sharepoint/</span>&quot; </li>          <li style="background: #f3f3f3">&#160; </li>          <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Id</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">afe52f83-a20e-42d4-8aa7-35d8c5fdfb39</span>&quot; </li>          <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Title</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Skynet Custom Ribbon Button</span>&quot; </li>          <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Scope</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Web</span>&quot; </li>          <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Description</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Skynet Custom Ribbon Button</span>&quot; </li>          <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">ImageUrl</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Skynet/WinEarth32x32.png</span>&quot;<span style="color: #0000ff">&gt;</span> </li>          <li style="background: #f3f3f3">&#160; <span style="color: #0000ff"></span></li>          <li>&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">ElementManifests</span><span style="color: #0000ff">&gt;</span> </li>          <li style="background: #f3f3f3">&#160; </li>          <li>&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">ElementManifest</span><span style="color: #0000ff"> </span><span style="color: #ff0000">Location</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">RibbonButton.xml</span>&quot;<span style="color: #0000ff">/&gt;</span> </li>          <li style="background: #f3f3f3">&#160; </li>          <li>&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">ElementManifests</span><span style="color: #0000ff">&gt;</span> </li>          <li style="background: #f3f3f3">&#160; </li>          <li><span style="color: #0000ff">&lt;/</span><span style="color: #a31515">Feature</span><span style="color: #0000ff">&gt;</span> </li>       </ol>     </div>   </div> </div>  <p></p>  <p><strong>Step 2: Create Feature Elements File</strong></p>  <p>Just like back in SharePoint 2007, we still need to create feature “Elements.xml” files.&#160; In this case I am calling mine “RibbonButton.xml”.&#160; This file contains the real information that dictates what kind of button is shown, what happens when you click on it and so forth.</p>  <p>There are a number of important things to point out about the XML snippet below.&#160; First is that in contrast to current documentation, I still needed to add lines 6 and 7 below where I am specifying that this CustomAction is geared for a Document Library list type – hence “101”, the code for Document Library which hasn’t changed since the last version of SharePoint and even the one before that if I am not mistaken.</p>  <p>Another item to note is line 8, the “Location” attribute.&#160; In Beta 1 we had to use “ViewToolbar” this has now been changed to “CommandUI.Ribbon”.</p>  <p>The attribute “Sequence” below on line 9, just as in the past, specifies the ordering of the button, now in terms of left to right as we are in the context of the horizontally aligned ribbon.&#160; The value “5” in this case is pretty low, so in my example this makes my custom button the first in its grouping (shown in screen shot below).</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px">   <div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid">     <div style="padding-bottom: 2px; padding-left: 5px; padding-right: 5px; font-family: verdana, tahoma, arial, sans-serif; background: #000080; color: #fff; font-weight: bold; padding-top: 2px">Code Snippet</div>      <div style="background: #ddd; overflow: auto">       <ol style="padding-bottom: 0px; margin: 0px 0px 0px 2.5em; padding-left: 5px; padding-right: 0px; background: #ffffff; padding-top: 0px">         <li><span style="color: #0000ff">&lt;</span><span style="color: #a31515">Elements</span><span style="color: #0000ff"> </span><span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">https://schemas.microsoft.com/sharepoint/</span>&quot;<span style="color: #0000ff">&gt;</span> </li>          <li style="background: #f3f3f3">&#160; </li>          <li>&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">CustomAction</span> </li>          <li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff"></span></li>          <li>&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Id</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">SkynetCustomRibbonButton</span>&quot; </li>          <li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">RegistrationId</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">101</span>&quot; </li>          <li>&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">RegistrationType</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">List</span>&quot; </li>          <li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Location</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">CommandUI.Ribbon</span>&quot; </li>          <li>&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Sequence</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">5</span>&quot; </li>          <li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Title</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Move Documents</span>&quot;<span style="color: #0000ff">&gt;</span> </li>          <li>&#160; </li>          <li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">CommandUIExtension</span><span style="color: #0000ff">&gt;</span> </li>          <li>&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">CommandUIDefinitions</span><span style="color: #0000ff">&gt;</span> </li>          <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">CommandUIDefinition</span><span style="color: #0000ff"> </span><span style="color: #ff0000">Location</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Ribbon.Documents.Manage.Controls._children</span>&quot;<span style="color: #0000ff">&gt;</span> </li>          <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">Button</span> </li>          <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Id</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Ribbon.Documents.New.SkynetTestButton</span>&quot; </li>          <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Alt</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Move Documents</span>&quot; </li>          <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Sequence</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">5</span>&quot; </li>          <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Command</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Skynet_Test_Button</span>&quot; </li>          <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Image32by32</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">/_layouts/images/Skynet/WinEarth32x32.png</span>&quot; </li>          <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Image16by16</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">/_layouts/images/Skynet/WinEarth16x16.png</span>&quot; </li>          <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">LabelText</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Move Documents</span>&quot; </li>          <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">TemplateAlias</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">o1</span>&quot;<span style="color: #0000ff"> /&gt;</span> </li>          <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">CommandUIDefinition</span><span style="color: #0000ff">&gt;</span> </li>          <li>&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">CommandUIDefinitions</span><span style="color: #0000ff">&gt;</span> </li>          <li style="background: #f3f3f3">&#160; </li>          <li>&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">CommandUIHandlers</span><span style="color: #0000ff">&gt;</span> </li>          <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">CommandUIHandler</span> </li>          <li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">Command</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">Skynet_Test_Button</span>&quot; </li>          <li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff"></span><span style="color: #ff0000">CommandAction</span><span style="color: #0000ff">=</span>&quot;<span style="color: #0000ff">javascript:alert('SharePoint 2010 Rocks!');</span>&quot;<span style="color: #0000ff"> /&gt;</span> </li>          <li>&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">CommandUIHandlers</span><span style="color: #0000ff">&gt;</span> </li>          <li style="background: #f3f3f3">&#160; </li>          <li>&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">CommandUIExtension</span><span style="color: #0000ff">&gt;</span> </li>          <li style="background: #f3f3f3">&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">CustomAction</span><span style="color: #0000ff">&gt;</span> </li>          <li>&#160; <span style="color: #0000ff"></span></li>          <li style="background: #f3f3f3"><span style="color: #0000ff">&lt;/</span><span style="color: #a31515">Elements</span><span style="color: #0000ff">&gt;</span> </li>       </ol>     </div>   </div> </div>  <p>&#160;</p>  <p>Looking down the XML snippet, we get to line 14.&#160; Here we specify the “Location” of the button in the ribbon.</p>  <p>The schema here is basically: <strong>Ribbon.[Tab].[Group].Controls._children</strong></p>  <p>Because the exact schema for these locations is not yet published, one learning tool I’ve been using is checking out the built-in features that come out of the box with SharePoint 2010 in the 14 Hive in the TEMPLATE\FEATURES folder.&#160; There are a number of features in there like In Place Records Management or Document Sets where you can get ideas of where that feature’s custom buttons are placed and then snag that location.</p>  <p>Another attribute to talk on is “Command” on line 19.&#160; Here we specify the name of the command which links together the “CommandUIDefinition” with its related “CommandUIHandler”.&#160; The “CommandUIDefinition” defines where the button goes and how it looks while the “CommandUIHandler” specifies the action that takes place when the button is clicked.</p>  <p>On line 23 is “TemplateAlias”.&#160; This was one I was not quite sure about until I messed around with it a bit and found that when I made the value “o2” it made the button into the smaller, 16 x 16 version of itself.</p>  <p>There is a lot more that you can do with this schema, such as specifying how the ribbon should scale on itself when the browser window is resized, such as which buttons take priority over others when ribbon space is reduced.&#160; Also, there are other types of ribbon controls and buttons you can use.&#160; One type you can get an idea from looking at the In Place Records Management feature schema is grouping multiple buttons under one parent drop down button.</p>  <p>Moving on to the “CommandUIHandler” section, there are some interesting items here to note as well.&#160; On line 29 we have our “Command” attribute again that links this “CommandUIHandler” with our “CommandUIDefinition” above.</p>  <p>More importantly is the “CommandAction” attribute.&#160; In Beta 1 this was called “CommandScript”, this has now been changed to “CommandAction” in this later build and I understand this will stay.&#160; In this attribute we specify the JavaScript that is invoked when the button is clicked.&#160; There are really an unlimited number of options of things you could do here.&#160; Some options include navigating to a different page, popping up an AJAX dialog, or performing actions on selected items.&#160; This is all possible now by using the new JavaScript SharePoint API.&#160; In my next blog post, I will walk through showing how to pop up an AJAX dialog box using the new JavaScript SharePoint API.</p>  <p>And that’s it for coding!&#160; The next step is just deploying the feature.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jfrost/WindowsLiveWriter/AddingCustomButtontotheSharePoint2010Rib_2A3/ribbon_button_screen_shot.png" original-url="https://blogs.msdn.com/blogfiles/jfrost/WindowsLiveWriter/AddingCustomButtontotheSharePoint2010Rib_2A3/ribbon_button_screen_shot.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="ribbon_button_screen_shot" border="0" alt="ribbon_button_screen_shot" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jfrost/WindowsLiveWriter/AddingCustomButtontotheSharePoint2010Rib_2A3/ribbon_button_screen_shot_thumb.png" original-url="https://blogs.msdn.com/blogfiles/jfrost/WindowsLiveWriter/AddingCustomButtontotheSharePoint2010Rib_2A3/ribbon_button_screen_shot_thumb.png" width="975" height="562" /></a> </p>  <p><strong>Step 3: Deploy Feature to SharePoint</strong></p>  <p>There are now a number of ways to deploy features to SharePoint 2010.&#160; STSADM is still available, however its been deprecated in preference to PowerShell and the vast amount of commandlets that come with it now for SharePoint 2010.&#160; Also, if you are using Visual Studio 2010, there have been significant improvements to its SharePoint development extensions that make it a first-class development tool now for SharePoint 2010.</p>  <p>In my case, I’ve been kicking it old school and using STSADM just to see if it still works, which it does!&#160; Below is my sample deployment .bat file script:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px">   <div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid">     <div style="padding-bottom: 2px; padding-left: 5px; padding-right: 5px; font-family: verdana, tahoma, arial, sans-serif; background: #000080; color: #fff; font-weight: bold; padding-top: 2px">Code Snippet</div>      <div style="background: #ddd; overflow: auto">       <ol style="padding-bottom: 0px; margin: 0px 0px 0px 2em; padding-left: 5px; padding-right: 0px; background: #ffffff; padding-top: 0px">         <li>stsadm -o deactivatefeature -name SkynetCustomRibbonButton -url https://spdev -force </li>          <li style="background: #f3f3f3">&#160; </li>          <li>stsadm -o uninstallfeature -name SkynetCustomRibbonButton -force </li>          <li style="background: #f3f3f3">&#160; </li>          <li>stsadm -o installfeature -name SkynetCustomRibbonButton -force </li>          <li style="background: #f3f3f3">&#160; </li>          <li>stsadm -o activatefeature -name SkynetCustomRibbonButton -url https://spdev -force </li>          <li style="background: #f3f3f3">&#160; </li>          <li>pause </li>       </ol>     </div>   </div> </div>]]></content:encoded>
    </item>
  </channel>
</rss>