<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blog.dennus.net</title>
	<atom:link href="http://blog.dennus.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dennus.net</link>
	<description>A reflection on Microsoft Office SharePoint Server 2007 (and other stuff...)</description>
	<lastBuildDate>Tue, 20 Jul 2010 09:28:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Using the SP2010 Client Object Model to update a list item</title>
		<link>http://blog.dennus.net/2010/07/20/using-the-sp2010-client-object-model-to-update-a-list-item/</link>
		<comments>http://blog.dennus.net/2010/07/20/using-the-sp2010-client-object-model-to-update-a-list-item/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 09:28:24 +0000</pubDate>
		<dc:creator>Dennis Meenhuis</dc:creator>
				<category><![CDATA[SP2010]]></category>

		<guid isPermaLink="false">http://blog.dennus.net/?p=88</guid>
		<description><![CDATA[In the previous post I wrote about having a custom ribbon button which handles a postback event. In the conclusion I also wrote that so far I haven't been able to figure out how to retrieve the selected item when the postback occurs. So I have been looking at alternatives to implement what I want, [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous post I wrote about having a custom ribbon button which handles a postback event. In the conclusion I also wrote that so far I haven't been able to figure out how to retrieve the selected item when the postback occurs. So I have been looking at alternatives to implement what I want, and decided to go with the new client object model so that I don't need a postback anymore.</p>
<p>First, we need to create a new empty SharePoint element in your SharePoint 2010 project in Visual Studio. The contents of the file is as following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Elements</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/sharepoint/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CustomAction</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;TicketResolvedRibbonCustomAction&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">RegistrationId</span>=<span style="color: #ff0000;">&quot;28582&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">RegistrationType</span>=<span style="color: #ff0000;">&quot;List&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">Location</span>=<span style="color: #ff0000;">&quot;CommandUI.Ribbon&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">Rights</span>=<span style="color: #ff0000;">&quot;ManageLists&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">Sequence</span>=<span style="color: #ff0000;">&quot;25&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">Title</span>=<span style="color: #ff0000;">&quot;Mark as Resolved&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CommandUIExtension<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CommandUIDefinitions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CommandUIDefinition</span> <span style="color: #000066;">Location</span>=<span style="color: #ff0000;">&quot;Ribbon.ListItem.Actions.Controls._children&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;TicketResolvedRibbonButton&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">Alt</span>=<span style="color: #ff0000;">&quot;Mark this ticket as resolved.&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">Description</span>=<span style="color: #ff0000;">&quot;Mark this ticket as resolved.&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">Sequence</span>=<span style="color: #ff0000;">&quot;25&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">Command</span>=<span style="color: #ff0000;">&quot;ResolveTicketCommand&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">Image32by32</span>=<span style="color: #ff0000;">&quot;/_layouts/images/Homburg.TicketDesk/ticketresolved.png&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">LabelText</span>=<span style="color: #ff0000;">&quot;Mark as Resolved&quot;</span>                  </span>
<span style="color: #009900;">                  <span style="color: #000066;">TemplateAlias</span>=<span style="color: #ff0000;">&quot;o1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CommandUIDefinition<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CommandUIDefinitions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CommandUIHandlers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CommandUIHandler</span> <span style="color: #000066;">Command</span>=<span style="color: #ff0000;">&quot;ResolveTicketCommand&quot;</span></span>
<span style="color: #009900;">                          <span style="color: #000066;">EnabledScript</span>=<span style="color: #ff0000;">&quot;javascript:</span>
<span style="color: #009900;">                             function enableResolveTicketButton()</span>
<span style="color: #009900;">                             {</span>
<span style="color: #009900;">                               var items = SP.ListOperation.Selection.getSelectedItems();</span>
<span style="color: #009900;">                               return (items.length == 1);</span>
<span style="color: #009900;">                             }</span>
<span style="color: #009900;">                             enableResolveTicketButton();&quot;</span></span>
<span style="color: #009900;">                          <span style="color: #000066;">CommandAction</span>=<span style="color: #ff0000;">&quot;javascript:TicketDeskMarkTicketAsResolved('{SelectedItemId}');&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CommandUIHandlers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CommandUIExtension<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CustomAction<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Control</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;AdditionalPageHead&quot;</span> <span style="color: #000066;">ControlSrc</span>=<span style="color: #ff0000;">&quot;~/_controltemplates/TicketResolvedRibbonDelegate.ascx&quot;</span> <span style="color: #000066;">Sequence</span>=<span style="color: #ff0000;">&quot;25&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Elements<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>So, compared to the element in my previous post, you'll now notice that there is a CommandUIHandlers element and I've specified a couple of things. First, I want to make sure that the button is only available when an item is actually selected. That's where the EnabledScript attribute is for. </p>
<p>The CommandAction attribute specifies the JavaScript method that will be called when the button is clicked. In this case, it's a method that's defined in the user control that's linked at the bottom of the XML definition. Now you can use some predefined parameters in your method calls, one of them being the ID of the current selected item: {SelectedItemId}.</p>
<p>Next, we need the user control, so create a new user control in the SharePoint CONTROLTEMPLATES folder in Visual Studio. In this case, we won't be needing anything in the code-behind file, everything occurs in the ASCX file itself.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>SharePoint<span style="color: #339933;">:</span>ScriptLink <span style="color: #000066;">Name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;SP.js&quot;</span> runat<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;server&quot;</span> LoadAfterUI<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;true&quot;</span> Localizable<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;false&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>SharePoint<span style="color: #339933;">:</span>FormDigest ID<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;FormDigest1&quot;</span> runat<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;server&quot;</span> <span style="color: #339933;">/&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;ecmascript&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/ecmascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">var</span> ticketsList<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> web<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> context<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> ticketId<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> ticketItem<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> ticketStatusField <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;TicketStatus&quot;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> ticketDoneStatus <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Done&quot;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> ticketResolvedStatus <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;OK&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> TicketDeskMarkTicketAsResolved<span style="color: #009900;">&#40;</span>itemId<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    ticketId <span style="color: #339933;">=</span> itemId<span style="color: #339933;">;</span>
&nbsp;
    context <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> SP.<span style="color: #660066;">ClientContext</span>.<span style="color: #660066;">get_current</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    web <span style="color: #339933;">=</span> context.<span style="color: #660066;">get_web</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ticketsList <span style="color: #339933;">=</span> web.<span style="color: #660066;">get_lists</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getByTitle</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Tickets&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ticketItem <span style="color: #339933;">=</span> ticketsList.<span style="color: #660066;">getItemById</span><span style="color: #009900;">&#40;</span>ticketId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// This will make sure the contents of the list and list item are actually loaded</span>
    context.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span>ticketsList<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    context.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span>ticketItem<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    context.<span style="color: #660066;">executeQueryAsync</span><span style="color: #009900;">&#40;</span>OnTicketsListsLoaded<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> OnTicketsListsLoaded<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> currentStatus <span style="color: #339933;">=</span> ticketItem.<span style="color: #660066;">get_item</span><span style="color: #009900;">&#40;</span>ticketStatusField<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// There's no need to continue this method when the status is already set to resolved or the ticket has been completed.</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>currentStatus <span style="color: #339933;">==</span> ticketResolvedStatus <span style="color: #339933;">||</span> currentStatus <span style="color: #339933;">==</span> ticketDoneStatus<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Set the ticket status field to the Resolved value</span>
    ticketItem.<span style="color: #660066;">set_item</span><span style="color: #009900;">&#40;</span>ticketStatusField<span style="color: #339933;">,</span> ticketResolvedStatus<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ticketItem.<span style="color: #660066;">update</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Submit the query to the server</span>
    context.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span>ticketItem<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    context.<span style="color: #660066;">executeQueryAsync</span><span style="color: #009900;">&#40;</span>OnTicketUpdated<span style="color: #339933;">,</span> <span style="color: #000066;">OnError</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> OnTicketUpdated<span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #006600; font-style: italic;">// Nothing really needed here other than refreshing the page to see that the change has been made</span>
    window.<span style="color: #660066;">location</span>.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> window.<span style="color: #660066;">location</span>.<span style="color: #660066;">href</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> <span style="color: #000066;">OnError</span><span style="color: #009900;">&#40;</span>sender<span style="color: #339933;">,</span> args<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>args.<span style="color: #660066;">get_message</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Going through the code, we see a couple of things. First we need a reference to SP.js, so we can actually use the client object model. The FormDigest tag is there so we can perform an update of a list item.</p>
<p>I'm declaring a couple of variables so I can use those in the various methods I have. The first method is the one that's being called from the XML element created in the first step. </p>
<p>In this method, I'm setting the context that's used to retrieve the web and list we're working with. Based on the ID that's supplied, I'm loading the list item on which the update should be performed. The list and list item are then loaded in the context after which a query is executed asynchronously, to retrieve the data. A callback method is defined for when the query has completed.</p>
<p>In the callback method, I'm doing a couple of checks to see whether an update is required. Then, by using set_item(), you can specify the field name and the value to update an item. The context is loaded again with the updated item and the update query is submitted to the server.</p>
<p>This is a very simple example of how to use the SP2010 client object model to perform an update on a list item. This can easily be extended with more complex business logic, to suit other needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dennus.net/2010/07/20/using-the-sp2010-client-object-model-to-update-a-list-item/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ribbon buttons with postback in SP2010</title>
		<link>http://blog.dennus.net/2010/07/20/ribbon-buttons-with-postback-in-sp2010/</link>
		<comments>http://blog.dennus.net/2010/07/20/ribbon-buttons-with-postback-in-sp2010/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 09:08:00 +0000</pubDate>
		<dc:creator>Dennis Meenhuis</dc:creator>
				<category><![CDATA[SP2010]]></category>

		<guid isPermaLink="false">http://blog.dennus.net/?p=83</guid>
		<description><![CDATA[For this Ticket Desk project I'm doing, I wanted to extend the default Ribbon UI with a new button that quickly allows the application admins to quickly mark a ticket as resolved. This is just a status field on the list item itself and you could even argue to just edit the item. However, since [...]]]></description>
			<content:encoded><![CDATA[<p>For this Ticket Desk project I'm doing, I wanted to extend the default Ribbon UI with a new button that quickly allows the application admins to quickly mark a ticket as resolved. This is just a status field on the list item itself and you could even argue to just edit the item. However, since there's a workflow involved and I want to hide the status field on the new and edit forms from ticket submitters, I'm providing the functionality via a ribbon button.</p>
<p>Now, in SharePoint 2007, I was used to doing something similar, but then I'd be using a custom action with a ControlAssembly and ControlClass specified. The class specified would just inherit from WebControl and I'd implement the IPostBackEventHandler interface and be on my way. I tried something similar in SP2010, however I got no dice. So, apparently things are a bit different in SP2010, let's find out what exactly. </p>
<p>First, let me outline what we need to get this to work:</p>
<ul>
<li>CustomAction element that defines the ribbon button</li>
<li>User control which will load the required JavaScript and handle the postback</li>
<li>JavaScript file containing the page component</li>
</ul>
<p>Right, I'm going to assume you know how to set-up an SP2010 project in Visual Studio 2010 and how to add the different types of items. First, create a new Empty Element which will contain the following XML:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Elements</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/sharepoint/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CustomAction</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;TicketResolvedRibbonCustomAction&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">RegistrationId</span>=<span style="color: #ff0000;">&quot;28582&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">RegistrationType</span>=<span style="color: #ff0000;">&quot;List&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">Location</span>=<span style="color: #ff0000;">&quot;CommandUI.Ribbon&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">Rights</span>=<span style="color: #ff0000;">&quot;ManageLists&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">Sequence</span>=<span style="color: #ff0000;">&quot;25&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">Title</span>=<span style="color: #ff0000;">&quot;Mark as Resolved&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CommandUIExtension<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CommandUIDefinitions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CommandUIDefinition</span> <span style="color: #000066;">Location</span>=<span style="color: #ff0000;">&quot;Ribbon.ListItem.Actions.Controls._children&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;TicketResolvedRibbonButton&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">Alt</span>=<span style="color: #ff0000;">&quot;Mark this ticket as resolved.&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">Description</span>=<span style="color: #ff0000;">&quot;Mark this ticket as resolved.&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">Sequence</span>=<span style="color: #ff0000;">&quot;25&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">Command</span>=<span style="color: #ff0000;">&quot;ResolveTicketCommand&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">Image32by32</span>=<span style="color: #ff0000;">&quot;/_layouts/images/TicketDesk/ticketresolved.png&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">LabelText</span>=<span style="color: #ff0000;">&quot;Mark as Resolved&quot;</span>                  </span>
<span style="color: #009900;">                  <span style="color: #000066;">TemplateAlias</span>=<span style="color: #ff0000;">&quot;o1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CommandUIDefinition<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CommandUIDefinitions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CommandUIExtension<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CustomAction<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Control</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;AdditionalPageHead&quot;</span> <span style="color: #000066;">ControlSrc</span>=<span style="color: #ff0000;">&quot;~/_controltemplates/TicketResolvedRibbonDelegate.ascx&quot;</span> <span style="color: #000066;">Sequence</span>=<span style="color: #ff0000;">&quot;25&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Elements<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Basically, this XML element defines that we have a custom action, which is bound to a List with template ID "28582". This is a custom list definition that's deployed with my solution, but you can also bind this to a content type for example. Furthermore, the location is on the ribbon and the rights required here are ManageLists. The CommandUIDefinition element specifies that the location of the button will be the list item tab, in the Actions group. There is a command specified here as well, which we will later need in our code-behind of the user control.</p>
<p>Note that I'm not specifying any CommandUIHandlers here. This is not necessary since we're handling the event on the server-side here, instead of client-side. So, instead of the handler, we define a user control that will be loaded in the AdditionalPageHead section of the masterpage. The location is linked to the default SharePoint CONTROLTEMPLATES folder, for which you can create a mapping in Visual Studio.</p>
<p>Next, we need the page component JavaScript file. Create a SharePoint mapped folder in Visual Studio which links to LAYOUTS, if you haven't done that so far. In this folder, create a new JavaScript file called "PageComponent.js". The contents of the file is as following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ULS_SP.<span style="color: #660066;">caller</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ULS_SP.<span style="color: #660066;">caller</span>.<span style="color: #660066;">ULSTeamName</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Windows SharePoint Services 4&quot;</span><span style="color: #339933;">;</span>
        ULS_SP.<span style="color: #660066;">caller</span>.<span style="color: #660066;">ULSFileName</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;/_layouts/TicketDesk/PageComponent.js&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
Type.<span style="color: #660066;">registerNamespace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'RibbonCustomization'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// RibbonApp Page Component</span>
RibbonCustomization.<span style="color: #660066;">PageComponent</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    RibbonCustomization.<span style="color: #660066;">PageComponent</span>.<span style="color: #660066;">initializeBase</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
RibbonCustomization.<span style="color: #660066;">PageComponent</span>.<span style="color: #660066;">initialize</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ExecuteOrDelayUntilScriptLoaded<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">Function</span>.<span style="color: #660066;">createDelegate</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> RibbonCustomization.<span style="color: #660066;">PageComponent</span>.<span style="color: #660066;">initializePageComponent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'SP.Ribbon.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
RibbonCustomization.<span style="color: #660066;">PageComponent</span>.<span style="color: #660066;">initializePageComponent</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> ribbonPageManager <span style="color: #339933;">=</span> SP.<span style="color: #660066;">Ribbon</span>.<span style="color: #660066;">PageManager</span>.<span style="color: #660066;">get_instance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">!==</span> ribbonPageManager<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ribbonPageManager.<span style="color: #660066;">addPageComponent</span><span style="color: #009900;">&#40;</span>RibbonCustomization.<span style="color: #660066;">PageComponent</span>.<span style="color: #660066;">instance</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        ribbonPageManager.<span style="color: #660066;">get_focusManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">requestFocusForComponent</span><span style="color: #009900;">&#40;</span>RibbonCustomization.<span style="color: #660066;">PageComponent</span>.<span style="color: #660066;">instance</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
RibbonCustomization.<span style="color: #660066;">PageComponent</span>.<span style="color: #660066;">refreshRibbonStatus</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    SP.<span style="color: #660066;">Ribbon</span>.<span style="color: #660066;">PageManager</span>.<span style="color: #660066;">get_instance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">get_commandDispatcher</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">executeCommand</span><span style="color: #009900;">&#40;</span>Commands.<span style="color: #660066;">CommandIds</span>.<span style="color: #660066;">ApplicationStateChanged</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
RibbonCustomization.<span style="color: #660066;">PageComponent</span>.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> 
<span style="color: #009900;">&#123;</span>
    getFocusedCommands<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
    getGlobalCommands<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> getGlobalCommands<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
    isFocusable<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
    receiveFocus<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
    yieldFocus<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
    canHandleCommand<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>commandId<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> commandEnabled<span style="color: #009900;">&#40;</span>commandId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
    handleCommand<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>commandId<span style="color: #339933;">,</span> properties<span style="color: #339933;">,</span> sequence<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ULS_SP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> handleCommand<span style="color: #009900;">&#40;</span>commandId<span style="color: #339933;">,</span> properties<span style="color: #339933;">,</span> sequence<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Register classes</span>
RibbonCustomization.<span style="color: #660066;">PageComponent</span>.<span style="color: #660066;">registerClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'RibbonCustomization.PageComponent'</span><span style="color: #339933;">,</span> CUI.<span style="color: #660066;">Page</span>.<span style="color: #660066;">PageComponent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
RibbonCustomization.<span style="color: #660066;">PageComponent</span>.<span style="color: #660066;">instance</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> RibbonCustomization.<span style="color: #660066;">PageComponent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Notify waiting jobs</span>
NotifyScriptLoadedAndExecuteWaitingJobs<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;/_layouts/TicketDesk/PageComponent.js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Note that I'm referring to the "/_layouts/TicketDesk" location, since that's the name of my project. You may need to change the location here to match your situation. From what I've gathered so far, this is object-oriented JavaScript that actually powers the ribbon button and can be considered as a template required for ribbon buttons. You can create your own implementations for the methods defined in the prototype, but in this case it's not needed, so we're going to leave the file as it is.</p>
<p>Now, on to the user control. In Visual Studio, create a mapping to the SharePoint CONTROLTEMPLATES folder. Add a new user control item in this folder. The ASCX file itself doesn't require any contents, so we're gonna go ahead and move to the source file.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">namespace</span> TicketDesk.<span style="color: #0000FF;">CONTROLTEMPLATES</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">partial</span> <span style="color: #FF0000;">class</span> TicketResolvedRibbonDelegate <span style="color: #008000;">:</span> UserControl, IPostBackEventHandler
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">void</span> Page_Load<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            var commands <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span>IRibbonCommand<span style="color: #008000;">&gt;</span>
                           <span style="color: #000000;">&#123;</span>
                               <span style="color: #008080; font-style: italic;">// The command name here matches the command name of the ribbon button</span>
                               <span style="color: #008000;">new</span> SPRibbonPostBackCommand<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;ResolveTicketCommand&quot;</span>, <span style="color: #0600FF;">this</span>,
                                                           <span style="color: #666666;">&quot;TicketResolvedRibbonButtonEvent&quot;</span>,
                                                           <span style="color: #0600FF;">null</span>, <span style="color: #666666;">&quot;true&quot;</span><span style="color: #000000;">&#41;</span>
                           <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Register ribbon scripts</span>
            var spRibbonScriptManager <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SPRibbonScriptManager<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            spRibbonScriptManager.<span style="color: #0000FF;">RegisterGetCommandsFunction</span><span style="color: #000000;">&#40;</span>Page, <span style="color: #666666;">&quot;getGlobalCommands&quot;</span>, commands<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            spRibbonScriptManager.<span style="color: #0000FF;">RegisterCommandEnabledFunction</span><span style="color: #000000;">&#40;</span>Page, <span style="color: #666666;">&quot;canHandleCommand&quot;</span>, commands<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            spRibbonScriptManager.<span style="color: #0000FF;">RegisterHandleCommandFunction</span><span style="color: #000000;">&#40;</span>Page, <span style="color: #666666;">&quot;handleCommand&quot;</span>, commands<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            InitRibbonScriptManager<span style="color: #000000;">&#40;</span>commands<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> InitRibbonScriptManager<span style="color: #000000;">&#40;</span>IEnumerable<span style="color: #008000;">&lt;</span>IRibbonCommand<span style="color: #008000;">&gt;</span> commands<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">// Register scripts</span>
            ScriptLink.<span style="color: #0000FF;">RegisterScriptAfterUI</span><span style="color: #000000;">&#40;</span>Page, <span style="color: #666666;">&quot;SP.Runtime.js&quot;</span>, <span style="color: #0600FF;">false</span>, <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            ScriptLink.<span style="color: #0000FF;">RegisterScriptAfterUI</span><span style="color: #000000;">&#40;</span>Page, <span style="color: #666666;">&quot;SP.js&quot;</span>, <span style="color: #0600FF;">false</span>, <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Register initialize function</span>
            var manager <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SPRibbonScriptManager<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            var methodInfo <span style="color: #008000;">=</span> <span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>SPRibbonScriptManager<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">GetMethod</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;RegisterInitializeFunction&quot;</span>, BindingFlags.<span style="color: #0000FF;">Instance</span> <span style="color: #008000;">|</span> BindingFlags.<span style="color: #0000FF;">NonPublic</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            methodInfo.<span style="color: #0000FF;">Invoke</span><span style="color: #000000;">&#40;</span>manager,
                <span style="color: #008000;">new</span> <span style="color: #FF0000;">object</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span>
                    <span style="color: #000000;">&#123;</span>
                        Page,
                        <span style="color: #666666;">&quot;InitPageComponent&quot;</span>,
                        <span style="color: #666666;">&quot;/_layouts/TicketDesk/PageComponent.js&quot;</span>,
                        <span style="color: #0600FF;">false</span>,
                        <span style="color: #666666;">&quot;RibbonCustomization.PageComponent.initialize()&quot;</span>
                    <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Register ribbon scripts</span>
            manager.<span style="color: #0000FF;">RegisterGetCommandsFunction</span><span style="color: #000000;">&#40;</span>Page, <span style="color: #666666;">&quot;getGlobalCommands&quot;</span>, commands<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            manager.<span style="color: #0000FF;">RegisterCommandEnabledFunction</span><span style="color: #000000;">&#40;</span>Page, <span style="color: #666666;">&quot;commandEnabled&quot;</span>, commands<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            manager.<span style="color: #0000FF;">RegisterHandleCommandFunction</span><span style="color: #000000;">&#40;</span>Page, <span style="color: #666666;">&quot;handleCommand&quot;</span>, commands<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> RaisePostBackEvent<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> eventArgument<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            Page.<span style="color: #0000FF;">Response</span>.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span>eventArgument<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Upon loading of the user control, we're going to add a new ribbon command, of type SPRibbonPostBackCommand. The command name here matches the command name of the button specified in the XML element earlier. We're also specifying an event ID in the constructor, so when the postback occurs, we can make sure we're handling the proper event. You could also specify event arguments in the constructor here.</p>
<p>Next, we need to instantiate a new SPRibbonScriptManager object. We're using that to register the JavaScript methods that we've defined in the previous step. Note that the function names here refer to methods in the JS prototype.</p>
<p>The page component file now needs to be registered to SharePoint. For a reason completely beyond me, the method required to do so, is not publically accessible through the API, so we'll need reflection to that. </p>
<p>For sake of demonstration purposes, the RaisePostBackEvent method isn't doing a lot here other than writing the event arguments to the page. Deploy your project and go to the list where your ribbon button should be visible and click it. You should now see that a postback is taking place and the event arguments should be written on top of the page.</p>
<p>The only thing I haven't really figured out yet is how to actually pass the ID of the item you've selected, hopefully I'll be able to write something about that in a follow-up post.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dennus.net/2010/07/20/ribbon-buttons-with-postback-in-sp2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open a list form dialog from the Quick Launch in SP2010</title>
		<link>http://blog.dennus.net/2010/07/14/open-a-list-form-dialog-from-the-quick-launch-in-sp2010/</link>
		<comments>http://blog.dennus.net/2010/07/14/open-a-list-form-dialog-from-the-quick-launch-in-sp2010/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 12:06:13 +0000</pubDate>
		<dc:creator>Dennis Meenhuis</dc:creator>
				<category><![CDATA[SP2010]]></category>

		<guid isPermaLink="false">http://blog.dennus.net/?p=76</guid>
		<description><![CDATA[One of the new cool features to streamline the user interface in SharePoint 2010 is the use of dialog windows, for example when creating or editing list items. Right now I'm on a project for a client where the goal is to create a ticket desk application in SharePoint. Users should be able to quickly [...]]]></description>
			<content:encoded><![CDATA[<p>One of the new cool features to streamline the user interface in SharePoint 2010 is the use of dialog windows, for example when creating or editing list items. Right now I'm on a project for a client where the goal is to create a ticket desk application in SharePoint.</p>
<p>Users should be able to quickly create new tickets without too much clicking through the application. The usual process would be to first navigate to the list itself, click Items under List Tools in the ribbon, expand the New Item button and select the content type of the ticket they wish to create. So that's 4 steps before they can actually do anything.</p>
<p>Initially I thought, I can add links in the Quick Launch for each ticket content type, so they can reach all options with only one click away. That works obviously, but a problem with this approach is that it just opens the page within the site, not in a dialog window and that's exactly what makes it look and behave better.</p>
<p>In SharePoint 2010 you can open dialog windows with the following method, available in the client API:</p>
<p><code>SP.UI.ModalDialog.showModalDialog(options);</code></p>
<p>More information here: <a href="http://msdn.microsoft.com/en-us/library/ff410058.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ff410058.aspx</a></p>
<p>It takes an object of type <code>SP.UI.DialogOptions</code> as a parameter, which allows you to set the URL, width, height and title of the dialog for example.</p>
<p>So, my initial approach was creating a custom master page in SharePoint Designer, and including a JavaScript method that would take a URL and title as parameters, and then opens the dialog.</p>
<p><code>function openCreateTicketDialog(formUrl, title)<br />
{<br />
   var options = {<br />
      url: formUrl,<br />
      title: title<br />
   };</p>
<p>   SP.UI.ModalDialog.showModalDialog(options);<br />
}</code></p>
<p>Apparently, the URL field of a Quick Launch entry doesn't necessarily have to be a valid URL. You could also include JavaScript in it, which is quite useful for what I'm trying to achieve here. So, for example, you could include the following, which will call the method defined above:</p>
<p><code>javascript:openCreateTicketDialog('/sites/ticketdesk/Lists/Tickets/NewForm.aspx?IsDlg=1&amp;ContentTypeId=0x0100AE3C77B418BC4C0D9C895BB740C2D7BA0056DC51CECF114FD6B2A7DD64A66C0A45', 'Press Publication');</code></p>
<p>You see the URL being opened is the new item form of my list, and I've included a ContentTypeId parameter to open the proper form and I've included the IsDlg=1 parameter, which will open the form in dialog mode. After saving the Quick Launch item and clicking on the newly created link, it indeed opens the form as a dialog!</p>
<p>Now, a potential drawback of this approach is that it requires you to customize the master page. For a scenario where you want as little customisations as possible, you could also perform the following neat little trick, to do away with the new master page:</p>
<p><code>javascript:function tdql1(){SP.UI.ModalDialog.showModalDialog({url:'/sites/ticketdesk/Lists/Tickets/NewForm.aspx?IsDlg=1&amp;ContentTypeId=0x0100AE3C77B418BC4C0D9C895BB740C2D7BA0056DC51CECF114FD6B2A7DD64A66C0A45', title:'Press Publication'})}tdql1();</code></p>
<p>What I did here is first declare a method that will actually make the call to the showModalDialog method. I'm using the JSON syntax to declare the object type that's supplied as the parameter to the method. After the method's been declared, we're making the call to it. The reason I'm using a new method, is that when you call <code>SP.UI.ModalDialog.showModalDialog()</code> directly in the Quick Launch URL field, for some reason it just opens a blank page with <code>[object Object()]</code>.</p>
<p>This may be a bit of a dirty trick, but it works very well when you want to open a dialog from your Quick Launch directly, without customisations. Do keep in mind that there is a limit to the amount of characters you can enter in the URL field, so the number of options you can supply will depend on the length of your arguments, and vice-versa.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dennus.net/2010/07/14/open-a-list-form-dialog-from-the-quick-launch-in-sp2010/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SharePoint 2010 Console Application Quirks</title>
		<link>http://blog.dennus.net/2010/07/13/sharepoint-2010-console-application-quirks/</link>
		<comments>http://blog.dennus.net/2010/07/13/sharepoint-2010-console-application-quirks/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 11:17:09 +0000</pubDate>
		<dc:creator>Dennis Meenhuis</dc:creator>
				<category><![CDATA[SP2010]]></category>

		<guid isPermaLink="false">http://blog.dennus.net/?p=67</guid>
		<description><![CDATA[So, in order to get the schema XML of some field I've created on my SharePoint 2010 site, I decided to write a quick console application to retrieve the data.I quickly discovered that apparently some things have changed regarding how to use a console application with SP2010. I figured the code would pretty much be [...]]]></description>
			<content:encoded><![CDATA[<p>So, in order to get the schema XML of some field I've created on my SharePoint 2010 site, I decided to write a quick console application to retrieve the data.I quickly discovered that apparently some things have changed regarding how to use a console application with SP2010. I figured the code would pretty much be the same as it was in 2007:</p>
<p><code>const string siteUrl = "http://spfoundation/sites/testsite";</p>
<p>using (SPSite site = new SPSite(siteUrl))<br />
{<br />
   using (SPWeb web = site.OpenWeb())<br />
   {<br />
      SPList list = web.Lists["Test"];<br />
      SPField field = list.Fields["Languages"];</p>
<p>       Console.WriteLine(field.SchemaXml);<br />
   }<br />
}</code></p>
<p>Running this code however, quickly resulted in an error:</p>
<blockquote><p>The Web application at http://spfoundation/sites/testsite could not be found.</p></blockquote>
<p>Surely I didn't make a typo, as I copied the URL from the browser and it works over there. After some looking around for what to do, I figured out there are a couple of things you need to change:</p>
<ul>
<li>You need to run Visual Studio 2010 as an administrator.*</li>
<li>The target framework of your application needs to be ".NET Framework 3.5"</li>
<li>Because SP2010 is a 64-bit application, the platform target of your application needs to be 64-bit as well. The setting "Any CPU" seems to be working as well.</li>
</ul>
<p>(*) I installed SP2010 on a workstation running on Windows 7 Professional, so this requirement may be different for scenarios where your Visual Studio is running on a server with SP2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dennus.net/2010/07/13/sharepoint-2010-console-application-quirks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint 2010 Forms Based Authentication Error</title>
		<link>http://blog.dennus.net/2010/07/12/sharepoint-2010-forms-based-authentication-error/</link>
		<comments>http://blog.dennus.net/2010/07/12/sharepoint-2010-forms-based-authentication-error/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 10:08:51 +0000</pubDate>
		<dc:creator>Dennis Meenhuis</dc:creator>
				<category><![CDATA[SP2010]]></category>

		<guid isPermaLink="false">http://blog.dennus.net/?p=61</guid>
		<description><![CDATA[I'm currently working at a client who's wish is to have a SharePoint 2010 site with forms based authentication, to manage the problem of the different locations having different domains. So, I found this really excellent guide written Donal Conlon, over here: http://donalconlon.wordpress.com/2010/02/23/configuring-forms-base-authentication-for-sharepoint-2010-using-iis7/ I followed every step of it, including the little caveat, which was [...]]]></description>
			<content:encoded><![CDATA[<p>I'm currently working at a client who's wish is to have a SharePoint 2010 site with forms based authentication, to manage the problem of the different locations having different domains.</p>
<p>So, I found this really excellent guide written Donal Conlon, over here: <a href="http://donalconlon.wordpress.com/2010/02/23/configuring-forms-base-authentication-for-sharepoint-2010-using-iis7/">http://donalconlon.wordpress.com/2010/02/23/configuring-forms-base-authentication-for-sharepoint-2010-using-iis7/</a></p>
<p>I followed every step of it, including the little caveat, which was to reset the default provider for .NET Users to the SharePoint Claims Provider.</p>
<p>However, when I logged on to my site, I was presented with a very interesting exception:</p>
<blockquote><p><code>&lt;nativehr&gt;0x8107058a&lt;/nativehr&gt;&lt;nativestack&gt;&lt;/nativestack&gt;Operation is not valid due to the current state of the object.</code></p></blockquote>
</blockquote>
<p>I Google'd the error message and came up with a couple of FBA-related posts, but no real solution. Having followed all the steps in the guide, I wasn't really sure what was going on exactly. Then I remembered the caveat, and that I initially made a change to the default role provider as well. </p>
<p>So I went back to IIS, changed the default role provider back to the claims authentication one, named "c" and tried the site again. Et voila; there it was, working with forms based authentication!</p>
<p>I didn't see this mentioned in the guide, so I thought I'd write it down, maybe it helps someone else. Although thinking about it, it makes sense to have to change the role provider back as well, it didn't occur to me initially <img src='http://blog.dennus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dennus.net/2010/07/12/sharepoint-2010-forms-based-authentication-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SP2010 &#8211; Quick writeup about list referential integrity</title>
		<link>http://blog.dennus.net/2009/11/19/sp2010-quick-writeup-about-list-referential-integrity/</link>
		<comments>http://blog.dennus.net/2009/11/19/sp2010-quick-writeup-about-list-referential-integrity/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 08:28:49 +0000</pubDate>
		<dc:creator>Dennis Meenhuis</dc:creator>
				<category><![CDATA[SP2010]]></category>

		<guid isPermaLink="false">http://blog.dennus.net/?p=45</guid>
		<description><![CDATA[There's a new and much requested feature in SP2010 and that's referential integrity on (custom) lists. This blog post is a quick writeup of that new feature just to document what I've found so far. Hopefully it's helpful for someone else as well. Right, we have our SharePoint site which contains two custom lists: - [...]]]></description>
			<content:encoded><![CDATA[<p>There's a new and much requested feature in SP2010 and that's referential integrity on (custom) lists. This blog post is a quick writeup of that new feature just to document what I've found so far. Hopefully it's helpful for someone else as well.</p>
<p>Right, we have our SharePoint site which contains two custom lists:</p>
<p>- ParentList<br />
- ChildList</p>
<p>ParentList has the following columns: Id, Title, Name, Address and City<br />
ChildList has the following columns: Id, Title</p>
<p>We're going to use a lookup column to relate the two lists together, just like it works in SharePoint 2007.</p>
<div id="attachment_46" class="wp-caption alignnone" style="width: 693px"><img class="size-full wp-image-46" title="Parent List with some sample data" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-lookup-parent-list.JPG" alt="Parent List with some sample data" width="683" height="122" /><p class="wp-caption-text">Parent List with some sample data</p></div>
<p>The screenshot above shows the parent list, including some sample data we're going to display in our child list. First, we're going to add the lookup column to the client list, so we can relate the two lists.</p>
<div id="attachment_48" class="wp-caption alignnone" style="width: 520px"><img class="size-full wp-image-48" title="Child List - New lookup column" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-lookup-column.JPG" alt="Child List - New Lookup column" width="510" height="375" /><p class="wp-caption-text">Child List - New Lookup column</p></div>
<p>Nothing new here <img src='http://blog.dennus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="attachment_49" class="wp-caption alignnone" style="width: 521px"><img class="size-full wp-image-49" title="Lookup Column Additional Info" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-lookup-column-additional-info.JPG" alt="Lookup Column Additional Info" width="511" height="477" /><p class="wp-caption-text">Lookup Column Additional Info</p></div>
<p>The thing that's new here, if I recall correctly, is that you can now select multiple columns from the parent last that you want to include in the child list. I've selected to display the Title, Name, Address and City of the parent list, as you can see in the screenshot. The screenshot shows a relationship on ParentList:ID, but I've changed that to Title in my own setup.</p>
<p>The new feature is depicted in the screenshot below. This feature allows you to specify whether you want to enforce a relationship on this data and what kind of action should be taken when an item in the parent list is deleted. In our example I'm going to restrict the deletion, which I'll demonstrate later. You could select cascade delete, and the item in the child list will be deleted upon deletion of the parent item, just like in a relational database. </p>
<div id="attachment_50" class="wp-caption alignnone" style="width: 520px"><img class="size-full wp-image-50" title="Lookup Column Relationship" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-lookup-relationship.JPG" alt="Lookup Column Relationship" width="510" height="283" /><p class="wp-caption-text">Lookup Column Relationship</p></div>
<p>However, when you try to add the column, SharePoint will likely come up with an alert, saying that the parent column needs to be indexed before the relationship can be enforced.</p>
<div id="attachment_54" class="wp-caption alignnone" style="width: 418px"><img class="size-full wp-image-54" title="Lookup column index" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-lookup-column-index.JPG" alt="Lookup column index" width="408" height="147" /><p class="wp-caption-text">Lookup column index</p></div>
<p>Just click OK here, to index the column. So, now that we've added the lookup column, the additional columns we've selected, are also displayed in the child list, like this:</p>
<div id="attachment_51" class="wp-caption alignnone" style="width: 690px"><img class="size-full wp-image-51" title="Client list after adding the lookup column" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-lookup-client-list1.JPG" alt="Client list after adding the lookup column" width="680" height="100" /><p class="wp-caption-text">Client list after adding the lookup column</p></div>
<p>You can see here that the additional columns have been added in a format of &lt;lookup column name&gt;:&lt;parent column name&gt;, so this allows for easy distinction between columns that are coming from the parent list and the ones that exist on the child list.</p>
<p>Adding a new item will result in the following form:</p>
<div id="attachment_52" class="wp-caption alignnone" style="width: 625px"><img class="size-full wp-image-52" title="New client item" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-lookup-new-client-item.JPG" alt="New client item" width="615" height="330" /><p class="wp-caption-text">New client item</p></div>
<p> <br />
As you can see here, you can select the parent item, which is nothing new obviously. The client list will look like this once the item has been added.</p>
<div id="attachment_53" class="wp-caption alignnone" style="width: 691px"><img class="size-full wp-image-53" title="Client list - item added" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-lookup-client-list-item-added.JPG" alt="Client list - item added" width="681" height="102" /><p class="wp-caption-text">Client list - item added</p></div>
<p>So, there you see the info that comes from the parent list. Now, let's try to delete the linked item in the parent list to see what will happen.</p>
<div id="attachment_55" class="wp-caption alignnone" style="width: 334px"><img class="size-full wp-image-55" title="Delete parent item" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-lookup-delete-parent-item.JPG" alt="Delete parent item" width="324" height="199" /><p class="wp-caption-text">Delete parent item</p></div>
<p>As expected, you will get an error message, indicating that you can't delete the item because of a relationship constraint between the items. The error could have been a bit more user friendly I suppose, but I've learned to expect stuff like this from SharePoint <img src='http://blog.dennus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="attachment_56" class="wp-caption alignnone" style="width: 567px"><img class="size-full wp-image-56" title="Parent list item delete error" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-lookup-delete-error.JPG" alt="Parent list item delete error" width="557" height="236" /><p class="wp-caption-text">Parent list item delete error</p></div>
<p>So, there you go, some quick information about relational integrity in SharePoint 2010. I think this should help us all utilize custom lists for scenarios where you'd rather use a database. Obviously, using a regular database brings a lot more advantages, but it's really nice to have this functionality in SharePoint now, without having to code your own event receivers and stuff. <img src='http://blog.dennus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dennus.net/2009/11/19/sp2010-quick-writeup-about-list-referential-integrity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SP2010 &#8211; Now possible to change your page layout on the fly?</title>
		<link>http://blog.dennus.net/2009/11/18/sp2010-now-possible-to-change-your-page-layout-on-the-fly/</link>
		<comments>http://blog.dennus.net/2009/11/18/sp2010-now-possible-to-change-your-page-layout-on-the-fly/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 14:37:05 +0000</pubDate>
		<dc:creator>Dennis Meenhuis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.dennus.net/?p=32</guid>
		<description><![CDATA[Wow, this seems like an interesting and much requested feature I just discovered in SharePoint 2010. It seems you can now change the page layout of an existing page! Maybe this is old news already, but I hadn't heard anything about it yet. So we have our regular article page right here: When you expand [...]]]></description>
			<content:encoded><![CDATA[<div class="mceTemp">Wow, this seems like an interesting and much requested feature I just discovered in SharePoint 2010. It seems you can now change the page layout of an existing page! Maybe this is old news already, but I hadn't heard anything about it yet.</div>
<p>So we have our regular article page right here:</p>
<div id="attachment_33" class="wp-caption alignnone" style="width: 961px"><img class="size-full wp-image-33" title="SP2010 Article Page" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-article-page.JPG" alt="SP2010 Article Page" width="951" height="505" /><p class="wp-caption-text">SP2010 Article Page</p></div>
<p>When you expand the Page Layout button on the ribbon, you get this:  </p>
<div id="attachment_36" class="wp-caption alignnone" style="width: 440px"><img class="size-full wp-image-36" title="SP2010 Change Page Layout" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-change-page-layout.JPG" alt="SP2010 Change Page Layout" width="430" height="519" /><p class="wp-caption-text">SP2010 Change Page Layout</p></div>
<p> Let's for example select Blank Web Part page as the new layout for our page. SharePoint then takes the new setting, doesn't perform a post-back anymore, AJAX is very nicely integrated now:</p>
<div class="mceTemp">
<div id="attachment_41" class="wp-caption alignnone" style="width: 457px"><img class="size-full wp-image-41" title="SP2010 - Changing Page Layout" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-changing-page-layout1.JPG" alt="SP2010 - Changing Page Layout" width="447" height="302" /><p class="wp-caption-text">SP2010 - Changing Page Layout</p></div>
</div>
<p>When SharePoint is done processing the changes, our page is now a web part page instead of the article page it was before!</p>
<div class="mceTemp">
<dl id="attachment_38" class="wp-caption alignnone" style="width: 995px;">
<dt class="wp-caption-dt"><img class="size-full wp-image-38" title="SP2010 - Web Part Page" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-web-part-page.JPG" alt="SP2010 - Web Part Page" width="985" height="526" /></dt>
<dd class="wp-caption-dd">SP2010 - Web Part Page</dd>
</dl>
<p> <br />
<strong>Edit:</strong></div>
<p>The functionality isn't completely bug-free yet. After playing around with a couple of different page layouts, I'm suddenly getting this error:</p>
<div class="mceTemp">
<dl id="attachment_43" class="wp-caption alignnone" style="width: 603px;">
<dt class="wp-caption-dt"><img class="size-full wp-image-43" title="SP2010 Change Page Layout Error" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-change-page-layout-error.JPG" alt="SP2010 Change Page Layout Error" width="593" height="298" /></dt>
<dd class="wp-caption-dd">SP2010 Change Page Layout Error</dd>
</dl>
<p>Obviously the product is still in beta, I'm sure this will be fixed in the final version <img src='http://blog.dennus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
]]></content:encoded>
			<wfw:commentRss>http://blog.dennus.net/2009/11/18/sp2010-now-possible-to-change-your-page-layout-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SP2010 &#8211; SPUserCodeV4 &#8211; Your new web part project isn&#8217;t deploying?</title>
		<link>http://blog.dennus.net/2009/11/18/sp2010-spusercodev4-your-new-web-part-project-isnt-deploying/</link>
		<comments>http://blog.dennus.net/2009/11/18/sp2010-spusercodev4-your-new-web-part-project-isnt-deploying/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 13:54:26 +0000</pubDate>
		<dc:creator>Dennis Meenhuis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.dennus.net/?p=24</guid>
		<description><![CDATA[So you've just gone through all the trouble to get the new SharePoint 2010 beta installed with the new Visual Studio 2010 beta alongside of it. You've created your first web part project and you're ready to deploy! Only one minor issue though, when you try to deploy, you're getting an error, saying that "Cannot [...]]]></description>
			<content:encoded><![CDATA[<p>So you've just gone through all the trouble to get the new SharePoint 2010 beta installed with the new Visual Studio 2010 beta alongside of it. You've created your first web part project and you're ready to deploy!</p>
<p>Only one minor issue though, when you try to deploy, you're getting an error, saying that "Cannot start service SPUserCodeV4 on computer &lt;computername&gt;".</p>
<div id="attachment_25" class="wp-caption alignnone" style="width: 629px"><img class="size-full wp-image-25" title="Visual Studio 2010 - SharePoint project deployment error" src="http://blog.dennus.net/wp-content/uploads/2009/11/vs2010-deploy-error.JPG" alt="Visual Studio 2010 - SharePoint project deployment error" width="619" height="235" /><p class="wp-caption-text">Visual Studio 2010 - SharePoint project deployment error</p></div>
<p>Although the screenshot shows an error with retracting, I was getting the same error when deploying. I figured, maybe it works if I deploy it again, but alas :)</p>
<p>The error is related to a service not being started on the SharePoint server. In order to start it, do the following:</p>
<p>- Go to Central Administration -&gt; System Settings -&gt; Manage services on server<br />
- Locate the service "Microsoft SharePoint Foundation User Code Service"</p>
<div id="attachment_27" class="wp-caption alignnone" style="width: 578px"><img class="size-full wp-image-27" title="SP2010 User Code Service" src="http://blog.dennus.net/wp-content/uploads/2009/11/sp2010-spusercode-service.JPG" alt="SP2010 User Code Service" width="568" height="114" /><p class="wp-caption-text">SP2010 User Code Service</p></div>
<p>On my server it wasn't started by default. I'm not sure if something went wrong during installation and that this service should be enabled by default. Just click the "Start" link button to start the service.</p>
<p>Now go back to Visual Studio 2010 and retry deploying your solution. In my case, this did the trick; the project was deployed successfully deployed!</p>
<div id="attachment_28" class="wp-caption alignnone" style="width: 592px"><img class="size-full wp-image-28" title="VS2010 Sharepoint Project Deployed" src="http://blog.dennus.net/wp-content/uploads/2009/11/vs2010-sharepoint-project-deployed.JPG" alt="VS2010 Sharepoint Project Deployed" width="582" height="254" /><p class="wp-caption-text">VS2010 Sharepoint Project Deployed</p></div>
<p> <br />
Thinking about it, it might have something to do with the order of installation. I installed Visual Studio 2010 after I installed and configured SharePoint 2010. Maybe for some reason SharePoint only picks this up when it can find a Visual Studio installation or something like that. Not too bothered to find out though, the installation took a few precious hours and I don't really feel like doing all that again <img src='http://blog.dennus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dennus.net/2009/11/18/sp2010-spusercodev4-your-new-web-part-project-isnt-deploying/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Making a custom Outlook ribbon group appear in another inspector &#8211; bugged?</title>
		<link>http://blog.dennus.net/2009/11/17/making-a-custom-outlook-ribbon-group-appear-in-another-inspector-bugged/</link>
		<comments>http://blog.dennus.net/2009/11/17/making-a-custom-outlook-ribbon-group-appear-in-another-inspector-bugged/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 15:30:30 +0000</pubDate>
		<dc:creator>Dennis Meenhuis</dc:creator>
				<category><![CDATA[VSTO]]></category>

		<guid isPermaLink="false">http://blog.dennus.net/?p=20</guid>
		<description><![CDATA[For a small assignment for a client, I've created this custom ribbon for Outlook, which holds a new group with a couple of custom controls relevant for a new mail message. They'd like to add a couple of extra MIME headers if any of the recipients is outside their domain. So far, this was relatively [...]]]></description>
			<content:encoded><![CDATA[<p>For a small assignment for a client, I've created this custom ribbon for Outlook, which holds a new group with a couple of custom controls relevant for a new mail message. They'd like to add a couple of extra MIME headers if any of the recipients is outside their domain. So far, this was relatively easy to do (still, I find the documentation about Outlook and VSTO a bit scarce, required quite the amount of Googling). However, since meeting requests can also have external recipients, the custom ribbon group should appear there as well.</p>
<p>Luckily, I found a blog post on a very good blog which explains how to do this. The post can be found <a href="http://blogs.msdn.com/vsto/archive/2008/04/09/making-a-custom-group-appear-in-the-message-tab-a-mail-item-norm-estabrook.aspx" target="_blank">here</a>.</p>
<p>So, I've followed the instructions there, created an event handler for the New Inspector event and built in a check to see if the new item is an meeting item. If so, set the OfficeId to "NewAppointment".</p>
<p>This generally seems to work, except when you open new items in a specific order. Then all of a sudden the custom group doesn't show up in the new meeting form anymore.</p>
<p>Following these steps seems to work just fine:</p>
<ul>
<li>Debug the application</li>
<li>Compose a new meeting (the custom group appears)</li>
<li>Compose a new mail message (the custom group appears)</li>
<li>Compose a new meeting item again (the custom group appears)</li>
</ul>
<p>However, when I change the steps to the following, the custom group doesn't appear anymore in a new meeting:</p>
<ul>
<li>Debug the application</li>
<li>Compose a new mail message (the custom group appears)</li>
<li>Compose a new meeting item (<strong>now all of a sudden the group doesn't show up anymore!</strong>)</li>
</ul>
<p>I can't really find out why it doesn't work. When adding a breakpoint to the Load event of the Ribbon, I did found out that for some reason the Load event doesn't fire anymore for a meeting in scenario #2. It works just fine if I follow the procedure in scenario #1 however.</p>
<p>The way I've currently solved it is by creating a duplicate of the ribbon and setting the OfficeId to "NewAppointment". Obviously, this doesn't deserve any prizes for elegance, but for now it does the trick...</p>
<p>I'll be sure to write an update to this post should I find out how to deal with this weird issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dennus.net/2009/11/17/making-a-custom-outlook-ribbon-group-appear-in-another-inspector-bugged/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Anonymous access settings on a list greyed out</title>
		<link>http://blog.dennus.net/2009/08/19/anonymous-access-settings-on-a-list-greyed-out/</link>
		<comments>http://blog.dennus.net/2009/08/19/anonymous-access-settings-on-a-list-greyed-out/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 06:20:05 +0000</pubDate>
		<dc:creator>Dennis Meenhuis</dc:creator>
				<category><![CDATA[MOSS 2007]]></category>

		<guid isPermaLink="false">http://blog.dennus.net/?p=17</guid>
		<description><![CDATA[Today I was trying to help out a client to set up one of their existing lists for anonymous access. I followed the usual procedure of editing the list permissions and then navigating to the anonymous access settings. However, all the checkboxes on the page were greyed out. I checked the anonymous access settings on [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was trying to help out a client to set up one of their existing lists for anonymous access. I followed the usual procedure of editing the list permissions and then navigating to the anonymous access settings. However, all the checkboxes on the page were greyed out.</p>
<p>I checked the anonymous access settings on both the site collection and the website and they all seemed fine. I checked another existing list and that seemed fine as well. Then I created a new list based on the same template as the list I was trying to configure, and that worked as well! Weird...</p>
<p>So I started searching on Google and came across a blog post about anonymous access on surveys here: <a href="http://www.teuntostring.net/blog/2007/07/using-surveys-on-anonymous-access.html">http://www.teuntostring.net/blog/2007/07/using-surveys-on-anonymous-access.html</a>. It's mentioned there that in order for anonymous access to work, the setting for 'Read Access' needs to be 'All Responses', otherwise the checkboxes will be greyed out. Then I remembered that we're using a similar setting our list, for privacy concerns.</p>
<p>I went back to the list, changed the setting for 'Read Access' to 'All items', went back to the anonymous access settings page, and voila! The checkboxes were no longer greyed out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dennus.net/2009/08/19/anonymous-access-settings-on-a-list-greyed-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
