<?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>Mirjam&#039;s blog</title>
	<atom:link href="http://vspug.com/mirjam/feed/" rel="self" type="application/rss+xml" />
	<link>http://vspug.com/mirjam</link>
	<description>Just another VSPUG - Virtual SharePoint User Group weblog</description>
	<lastBuildDate>Wed, 30 Sep 2009 10:09:03 +0000</lastBuildDate>
	<generator>http://vspug.com?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Programmatically adjusting the toolbar of a ListViewWebPart</title>
		<link>http://vspug.com/mirjam/2009/07/24/programmatically-adjusting-the-toolbar-of-a-listviewwebpart/</link>
		<comments>http://vspug.com/mirjam/2009/07/24/programmatically-adjusting-the-toolbar-of-a-listviewwebpart/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 15:18:00 +0000</pubDate>
		<dc:creator>Mirjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[


This blog has moved.&#160; Click here to open this post on my new blog.



 
I have been doing more work on programmatically adding lists, views and ListViewWebParts to automatically created sites this week and I&#8217;ve stumbled onto another challenge that took me more time than I expected to solve.
 
I&#8217;m creating sites and pogrammaticaly adding ListViewWebParts to [...]]]></description>
			<content:encoded><![CDATA[<table border="2" align="center" cellpadding="5" cellspacing="0" style="background-color:#ff00ff;border:#000000 2px solid">
<tbody>
<tr>
<td>This blog has moved.&nbsp; <a href="http://www.sharepointchick.com/archive/2009/07/24/programmatically-adjusting-the-toolbar-of-a-listviewwebpart.aspx">Click here</a> to open this post on my new blog.</td>
</tr>
</tbody>
</table>
<p> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB">I have been doing more work on programmatically adding lists, views and ListViewWebParts to automatically created sites this week and I&#8217;ve stumbled onto another challenge that took me more time than I expected to solve.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB">I&#8217;m creating sites and pogrammaticaly adding ListViewWebParts to the default.aspx page of that site. By default a ListViewWebPart that is added to a page shows the Full Toolbar. This isn&#8217;t always what you want. Even worse, it&#8217;s usually not what you want.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB">If you add a ListViewWebPart to a page through the UI you can click Modify Shared Web Part and choose which toolbar type you want to use in the toolpart of the web part:</p>
<ul style="margin-top:0in;direction:ltr;margin-bottom:0in;margin-left:0.375in">
<li><span style="font-family:Calibri;font-size:11pt">Full Toolbar</span></li>
<li><span style="font-family:Calibri;font-size:11pt">Summary Toolbar</span></li>
<li><span style="font-family:Calibri;font-size:11pt">No Toolbar </span></li>
</ul>
<p style="margin:0in;font-family:Calibri;font-size:11pt"><span lang="en-GB">Unfortunately the object model doesn&#8217;t have a property that lets you set the toolbar type. The SPView object does have a ToolbarType property, but this is read-only. I&#8217;m of course not the first person to run into this problem and there are a couple of blog posts out there that propose a solution to this problem. Unfortunately most of them don&#8217;t work anymore after the infrastructure update. Ton Stegeman wrote a great post where he shares the code that lets you change the toolbar type if you have installed the infrastructure update. (</span><a href="http://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?List=70640fe5-28d9-464f-b1c9-91e07c8f7e47&amp;ID=90"><span lang="nl">http://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?List=70640fe5-28d9-464f-b1c9-91e07c8f7e47&amp;ID=90</span></a><span lang="en-GB">) Ton&#8217;s post shows how to set the toolbar type to None (which is the same as selecting No Toolbar&#8221; in the UI. In my case the type of toolbar depends on the web part. There are web parts that shouldn&#8217;t have a toolbar at all, but there are also web parts that should have a summary toolbar. Of course if there are web parts that need a full toolbar you can just leave them as they are, as they get a full toolbar by default when they are added to the page.</span></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB">Oh and be aware that taking shortcuts doesn&#8217;t really help in this case.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB">I tried to change the toolbar right when adding the web part, but that didn&#8217;t work too well. You should really add the web part first and then loop through the web parts on the page to change them.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB">Same thing is true for the views. I tried to adjust the view that I use when adding the web part, instead of getting the view from the web part that is already on the page. Doesn&#8217;t work either. You need to get the view of the web part by using reflection and adjust that view to get this working. Otherwise you&#8217;ll adjust the view of the list.( You can use this on April Fool&#8217;s Day…set the toolbar of the views of your list to none. Users will go into the list and won&#8217;t be able to see the toolbar and add items, even if they have full control.)</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB">This is the code I used (again, courtesy to Ton, without his post I might still be looking for the solution).</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB"> </p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:#2b91af">SPLimitedWebPartManager</span> wpManager = newWeb.GetLimitedWebPartManager(<span style="color:#a31515">&#8220;pages/default.aspx&#8221;</span>, <span style="color:#2b91af">PersonalizationScope</span>.Shared);</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Get all web parts that are available on the default.aspx page</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:#2b91af">SPLimitedWebPartCollection</span> webParts = wpManager.WebParts;</p>
<p style="margin:0in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Loop through the collection of all web parts on the page</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">foreach</span> (System.Web.UI.WebControls.WebParts.<span style="color:#2b91af">WebPart</span> webPartOnPage <span style="color:blue">in</span> webParts)</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US">{</p>
<p style="margin:0in 0in 0in 0.375in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Only try to set the toolbar type is the web part is a ListViewWebPart, other web part types don&#8217;t have toolbars</p>
<p style="margin:0in 0in 0in 0.375in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">if</span> (webPartOnPage.GetType().Name == <span style="color:#a31515">&#8220;ListViewWebPart&#8221;</span>)</p>
<p style="margin:0in 0in 0in 0.375in;font-family:'Courier New';font-size:10pt" lang="en-US">{</p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:#2b91af">ListViewWebPart</span> listViewWebPart = webPartOnPage <span style="color:blue">as</span> <span style="color:#2b91af">ListViewWebPart</span>;</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Get the view used in the web part by using reflection</p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:#2b91af">PropertyInfo</span> viewProp = listViewWebPart.GetType().GetProperty(<span style="color:#a31515">&#8220;View&#8221;</span>, <span style="color:#2b91af">BindingFlags</span>.NonPublic | <span style="color:#2b91af">BindingFlags</span>.Instance);</p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:#2b91af">SPView</span> webPartView = viewProp.GetValue(listViewWebPart, <span style="color:blue">null</span>) <span style="color:blue">as</span> <span style="color:#2b91af">SPView</span>;</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// This is necessary after the infrastructure update, without it you can&#8217;t get to the XML of the view</p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';font-size:10pt" lang="en-US">webPartView.GetType().InvokeMember(<span style="color:#a31515">&#8220;EnsureFullBlownXmlDocument&#8221;</span>, <span style="color:#2b91af">BindingFlags</span>.NonPublic | <span style="color:#2b91af">BindingFlags</span>.Instance | <span style="color:#2b91af">BindingFlags</span>.InvokeMethod, <span style="color:blue">null</span>, webPartView, <span style="color:blue">null</span>, System.Globalization.<span style="color:#2b91af">CultureInfo</span>.CurrentCulture);</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:#2b91af">PropertyInfo</span> nodeProp = webPartView.GetType().GetProperty(<span style="color:#a31515">&#8220;Node&#8221;</span>, <span style="color:#2b91af">BindingFlags</span>.NonPublic | <span style="color:#2b91af">BindingFlags</span>.Instance);</p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:#2b91af">XmlNode</span> node = nodeProp.GetValue(webPartView, <span style="color:blue">null</span>) <span style="color:blue">as</span> <span style="color:#2b91af">XmlNode</span>;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Get the toolbar node from the XML of the view used in the web part</p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:#2b91af">XmlNode</span> toolbarNode = node.SelectSingleNode(<span style="color:#a31515">&#8220;Toolbar&#8221;</span>);</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Different action is needed depending on the web part</p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">switch</span> (webPartOnPage.Title)</p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';font-size:10pt" lang="en-US">{</p>
<p style="margin:0in 0in 0in 1.125in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">case</span> <span style="color:#a31515">&#8220;Project Announcements&#8221;</span>:</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">if</span> (toolbarNode != <span style="color:blue">null</span>)</p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US">{</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Set toolbar type to Summary Toolbar</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">toolbarNode.Attributes[<span style="color:#a31515">"Type"</span>].Value = <span style="color:#a31515">&#8220;Freeform&#8221;</span>;</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:#2b91af">XmlAttribute</span> positionNode = toolbarNode.OwnerDocument.CreateAttribute(<span style="color:#a31515">&#8220;Position&#8221;</span>);</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">positionNode.Value = <span style="color:#a31515">&#8220;After&#8221;</span>;</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">toolbarNode.Attributes.Append(positionNode);</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Add the CAML</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">toolbarNode.InnerXml = <span style="color:#a31515">@&#8221;&lt;IfHasRights&gt;&lt;RightsChoices&gt;&lt;RightsGroup PermAddListItems=&#8221;"required&#8221;" /&gt;&lt;/RightsChoices&gt;&lt;Then&gt;&lt;HTML&gt;&lt;![CDATA[ &lt;table width=100% cellpadding=0 cellspacing=0 border=0 &gt; &lt;tr&gt; &lt;td colspan=""2"" class=""ms-partline""&gt;&lt;IMG src=""/_layouts/images/blank.gif"" width=1 height=1 alt=""""&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class=""ms-addnew"" style=""padding-bottom: 3px""&gt; &lt;img src=""/_layouts/images/rect.gif"" alt=""""&gt;&amp;nbsp;&lt;a class=""ms-addnew"" ID=""idAddNewItem"" href=""]]&gt;&lt;/HTML&gt;&lt;URL Cmd=&#8221;"New&#8221;" /&gt;&lt;HTML&gt;&lt;![CDATA["" ONCLICK=""BLOCKED SCRIPTNewItem(']]&gt;&lt;/HTML&gt;&lt;URL Cmd=&#8221;"New&#8221;" /&gt;&lt;HTML&gt;&lt;![CDATA[', true);BLOCKED SCRIPTreturn false;"" target=""_self""&gt;]]&gt;&lt;/HTML&gt;&lt;HTML&gt;Add new announcement&lt;/HTML&gt;&lt;HTML&gt;&lt;![CDATA[&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;IMG src=""/_layouts/images/blank.gif"" width=1 height=5 alt=""""&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;]]&gt;&lt;/HTML&gt;&lt;/Then&gt;&lt;/IfHasRights&gt;&#8221;</span>;</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">webPartView.Update();</p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US">}</p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">break</span>;</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 1.125in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">case</span> <span style="color:#a31515">&#8220;Project Tasks&#8221;</span>:</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">if</span> (toolbarNode != <span style="color:blue">null</span>)</p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US">{</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Set toolbar type to No Toolbar</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">toolbarNode.Attributes[<span style="color:#a31515">"Type"</span>].Value = <span style="color:#a31515">&#8220;None&#8221;</span>;</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">webPartView.Update();</p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US">}</p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">break</span>;</p>
<p style="margin:0in 0in 0in 1.125in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">case</span> <span style="color:#a31515">&#8220;Calendar&#8221;</span>:</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">if</span> (toolbarNode != <span style="color:blue">null</span>)</p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US">{</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Set toolbar type to Summary Toolbar</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">toolbarNode.Attributes[<span style="color:#a31515">"Type"</span>].Value = <span style="color:#a31515">&#8220;Freeform&#8221;</span>;</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:#2b91af">XmlAttribute</span> positionNode = toolbarNode.OwnerDocument.CreateAttribute(<span style="color:#a31515">&#8220;Position&#8221;</span>);</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">positionNode.Value = <span style="color:#a31515">&#8220;After&#8221;</span>;</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">toolbarNode.Attributes.Append(positionNode);</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';color:green;font-size:10pt" lang="en-US">// Add the CAML</p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">toolbarNode.InnerXml = <span style="color:#a31515">@&#8221;&lt;IfHasRights&gt;&lt;RightsChoices&gt;&lt;RightsGroup PermAddListItems=&#8221;"required&#8221;" /&gt;&lt;/RightsChoices&gt;&lt;Then&gt;&lt;HTML&gt;&lt;![CDATA[ &lt;table width=100% cellpadding=0 cellspacing=0 border=0 &gt; &lt;tr&gt; &lt;td colspan=""2"" class=""ms-partline""&gt;&lt;IMG src=""/_layouts/images/blank.gif"" width=1 height=1 alt=""""&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class=""ms-addnew"" style=""padding-bottom: 3px""&gt; &lt;img src=""/_layouts/images/rect.gif"" alt=""""&gt;&amp;nbsp;&lt;a class=""ms-addnew"" ID=""idAddNewItem"" href=""]]&gt;&lt;/HTML&gt;&lt;URL Cmd=&#8221;"New&#8221;" /&gt;&lt;HTML&gt;&lt;![CDATA["" ONCLICK=""BLOCKED SCRIPTNewItem(']]&gt;&lt;/HTML&gt;&lt;URL Cmd=&#8221;"New&#8221;" /&gt;&lt;HTML&gt;&lt;![CDATA[', true);BLOCKED SCRIPTreturn false;"" target=""_self""&gt;]]&gt;&lt;/HTML&gt;&lt;HTML&gt;Add new event&lt;/HTML&gt;&lt;HTML&gt;&lt;![CDATA[&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;IMG src=""/_layouts/images/blank.gif"" width=1 height=5 alt=""""&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;]]&gt;&lt;/HTML&gt;&lt;/Then&gt;&lt;/IfHasRights&gt;&#8221;</span>;</p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 1.875in;font-family:'Courier New';font-size:10pt" lang="en-US">webPartView.Update();</p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US">}</p>
<p style="margin:0in 0in 0in 1.5in;font-family:'Courier New';font-size:10pt" lang="en-US"><span style="color:blue">break</span>;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:'Courier New';font-size:10pt" lang="en-US">}<span style="color:green">//Switch</span></p>
<p style="margin:0in 0in 0in 0.375in;font-family:'Courier New';font-size:10pt" lang="en-US">}<span style="color:green">//if ListViewWebPart</span></p>
<p style="margin:0in;font-family:'Courier New';font-size:10pt">}<span style="color:green">//foreach webpart</span></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-GB"> </p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/mirjam/2009/07/24/programmatically-adjusting-the-toolbar-of-a-listviewwebpart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a custom view that filters on the current user or [Me]</title>
		<link>http://vspug.com/mirjam/2009/07/16/creating-a-custom-view-that-filters-on-the-current-user-or-me/</link>
		<comments>http://vspug.com/mirjam/2009/07/16/creating-a-custom-view-that-filters-on-the-current-user-or-me/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 14:29:00 +0000</pubDate>
		<dc:creator>Mirjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[


This blog has moved.&#160; Click here to open this post on my new blog.



&#160;
Earlier this week I was creating custom list views for a customer solution. On of the specifications was that the view needed a filter that only showed the documents that were created by the current user. You can do this using the [...]]]></description>
			<content:encoded><![CDATA[<table border="2" align="center" cellpadding="5" cellspacing="0" style="background-color:#ff00ff;border:#000000 2px solid">
<tbody>
<tr>
<td>This blog has moved.&nbsp; <a href="http://www.sharepointchick.com/archive/2009/07/16/creating-a-custom-view-that-filters-on-the-current-user.aspx">Click here</a> to open this post on my new blog.</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">Earlier this week I was creating custom list views for a customer solution. On of the specifications was that the view needed a filter that only showed the documents that were created by the current user. You can do this using the user interface by specifying that the Created By field needed to be equal to [Me].</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt"><img src="/oldweblogfiles/mirjam/filterviewbycurrentuser.jpg" border="0" alt="  " /></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">I was trying to get this same behaviour by adding a CAML query to my view<span>&nbsp; </span>using the following code:</p>
<p style="margin:0in;font-family:Calibri;color:black;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;color:black;font-size:11pt">StringCollection viewFields = new StringCollection();<br />viewFields.Add(&quot;Title&quot;);<br />viewFields.Add(&quot;Description&quot;);<br />SPView newView = myDocLib.Views.Add(&quot;My documents&quot;, viewFields, &quot;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&#39;Author&#39; /&gt;&lt;Value Type=&#39;User&#39;&gt;[Me]&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&quot;, 100, true, false);</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">This didn&#39;t work, but when I opened the view and saved it again it did work. I tried to search the internet by looking for &quot;sharepoint, spview, [Me]&quot; and I couldn&#39;t find a soluton, which is the reason for this post.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">Eventually I posted my question on the MSDN forums <a href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/a4c20e84-4201-4106-9568-df3cfbcd5d3b/">http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/a4c20e84-4201-4106-9568-df3cfbcd5d3b/</a> and after only a couple of minutes <a target="_blank" href="http://www.davehunter.co.uk/blog" title="Dave Hunter&#39;s blog">Dave Hunter</a>&nbsp; came back with the answer. The correct way to define a view that filters based on the current user using the object model is:</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;color:black;font-size:11pt"><span style="font-family:Calibri">StringCollection viewFields = new StringCollection();<br />viewFields.Add(&quot;Title&quot;);<br />viewFields.Add(&quot;Description&quot;);<br />SPView newView = myDocLib.Views.Add(&quot;My documents&quot;, viewFields, &quot;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&#39;Author&#39; /</span><span style="font-family:inherit">&gt;&lt;Value Type=&quot;Integer&quot;&gt;&lt;UserID Type=&quot;Integer&quot;/&gt;&lt;/Value&gt;&lt;/</span><span style="font-family:Calibri">Eq&gt;&lt;/Where&gt;&quot;, 100, true, false);</span></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">Dave also gave the great tip that you can find the CAML for a specific view by doing the following:</p>
<ul style="margin-top:0in;direction:ltr;margin-bottom:0in;margin-left:0.375in">
<li><span style="font-family:Calibri;font-size:11pt">Define the view using the user interface</span></li>
<li><span style="font-family:Calibri;font-size:11pt">Save the list as a template</span></li>
<li><span style="font-family:Calibri;font-size:11pt">Download the template </span></li>
<li><span style="font-family:Calibri;font-size:11pt">Rename the .stp file to .cab</span></li>
<li><span style="font-family:Calibri;font-size:11pt">Extract the manifest.xml from the .cab file and find the &lt;Query&gt; definition</span></li>
</ul>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">Thanks again Dave!</p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/mirjam/2009/07/16/creating-a-custom-view-that-filters-on-the-current-user-or-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Site Column Definition Schema</title>
		<link>http://vspug.com/mirjam/2009/06/30/site-column-definition-schema/</link>
		<comments>http://vspug.com/mirjam/2009/06/30/site-column-definition-schema/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 10:49:00 +0000</pubDate>
		<dc:creator>Mirjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[


This blog has moved.&#160; Click here to open this post on my new blog.



&#160;
While working on a customer project I had to create a lot of site columns, based on the columns created by a business analyst through the user interface.
As I was creating the site columns through a feature I was trying to find [...]]]></description>
			<content:encoded><![CDATA[<table border="2" align="center" cellpadding="5" cellspacing="0" style="background-color:#ff00ff;border:#000000 2px solid">
<tbody>
<tr>
<td>This blog has moved.&nbsp; <a href="http://www.sharepointchick.com/archive/2009/06/30/site-column-definition-schema.aspx">Click here</a> to open this post on my new blog.</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">While working on a customer project I had to create a lot of site columns, based on the columns created by a business analyst through the user interface.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">As I was creating the site columns through a feature I was trying to find the Site Column Definition Schema on MSDN. And I found it. It can be found here <a href="http://msdn.microsoft.com/en-us/library/ms459922.aspx">http://msdn.microsoft.com/en-us/library/ms459922.aspx</a>. Too bad it &#39;s not a complete overview. That might have something to do with the disclaimer at the top of the page though:</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;color:red;font-size:11pt">[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.] </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">Maybe there is a full reference somewhere on Technet or MSDN and I just couldn&#39;t find it, but this wasn&#39;t much help to me.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">Luckily I was able to use <a target="_blank" href="http://blogs.mosshosting.com/archive/2009/02/26/creating-site-columns-using-features.aspx">the great post Brian LaSitis did</a> that has a nice overview of all properties of all column types in it.&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">[Update]</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt"><a target="_blank" href="http://blogs.code-counsel.net/Wouter/default.aspx" title="Wouter&#39;s blog">Wouter van Vught</a>&nbsp;just tipped me that you shouldn&#39;t always use StaticName and SourceID. This info is<span>&nbsp; </span>coming from <a target="_blank" href="http://thorprojects.com/blog/archive/2009/05/14/using-word-quickparts-to-enter-metadata-for-sharepoint.aspx" title="Blog post by Robert Bogue">this blog post by Robert Bogue</a>. </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">He says:</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&quot; Version, StaticName, and SourceID aren&#39;t attributes that should typically be set. Version isn&#39;t supported at all, StaticName is only for the office clients, and SourceId is supposed to be set by the framework to the feature that created the field. SourceId is supposed to help you work back to the feature that created the fields. Well, as it turns out if you set this field to be the same as the sourceId for the fields that you added in via the UI, SharePoint doesn&#39;t mangle the document template. (So leave the sourceId in &#8212; for this case only). &quot;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">My colleague Maarten gave me a tip to go and look at <a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms437580.aspx" title="Field Element page on MSDN">this page</a> that contains information about the Field Element.&nbsp;Some of this information can be used to help determine&nbsp;how site&nbsp;columns should be&nbsp;described. </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">[Update2]</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">Found out that this post by Brian LaSitis doesn&#39;t contain all possible options. I&#39;m adding a few extra options that I needed myself here. If you know of more options that aren&#39;t mentioned in the Brian&#39;s blog let me know by leaving a comment with the option and the field type.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt;font-weight:bold">Choice Field</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&lt;Field ID=&quot;{8e2b16ee-86ce-49c5-b217-91a1eee4e664}&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Name=&quot;Project&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">StaticName=&quot;Project&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">DisplayName=&quot;Project&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Description=&quot;&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Group=&quot;My Columns&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Type=&quot;Choice&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">SourceID=&quot;<a href="http://schemas.microsoft.com/sharepoint/v3/fields">http://schemas.microsoft.com/sharepoint/v3/fields</a>&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Format=&quot;[Dropdown/RadioButtons]&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">FillInChoice=&quot;FALSE&quot;&gt;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">&lt;CHOICES&gt;</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">&lt;CHOICE&gt;Project A&lt;/CHOICE&gt;</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">&lt;CHOICE&gt;Project B&lt;/CHOICE&gt;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">&lt;/CHOICES&gt;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">&lt;Default&gt;No&lt;/Default&gt;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&lt;/Field&gt;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt;font-weight:bold">DateTime Field</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&lt;Field ID=&quot;{b0cda4bf-3588-498b-8f5b-dcd5f860ecf0}&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Name=&quot;DueDate&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">StaticName=&quot;DueDate&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">DisplayName=&quot;Due Date&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Description=&quot;&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Group=&quot;My Columns&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Type=&quot;DateTime&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Format=&quot;[DateTime/DateOnly]&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">SourceID=&quot;<a href="http://schemas.microsoft.com/sharepoint/v3/fields%22/">http://schemas.microsoft.com/sharepoint/v3/fields&quot;/</a>&gt;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt;font-weight:bold">Note Field</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&lt;Field ID=&quot;{c8da1af1-5a97-4ea9-8055-bfd9ea4e89e1}&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Name=&quot;Comments&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">StaticName=&quot;Comments&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">DisplayName=&quot;Comments&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Description=&quot;&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Group=&quot;My Columns&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">Type=&quot;Note&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">NumLines=&quot;6&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">AppendOnly=&quot;TRUE&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">RichText=&quot;TRUE&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">RichTextMode=&quot;[Compatible/FullHtml]&quot;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">SourceID=&quot;<a href="http://schemas.microsoft.com/sharepoint/v3/fields%22/">http://schemas.microsoft.com/sharepoint/v3/fields&quot;/</a>&gt;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/mirjam/2009/06/30/site-column-definition-schema/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>User Profiles and User Information List Synchronization</title>
		<link>http://vspug.com/mirjam/2009/06/17/user-profiles-and-the-user-information-list-or-userinfo-table/</link>
		<comments>http://vspug.com/mirjam/2009/06/17/user-profiles-and-the-user-information-list-or-userinfo-table/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 09:44:00 +0000</pubDate>
		<dc:creator>Mirjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[


This blog has moved.&#160; Click here to open this post on my new blog.



&#160;&#160;

Lately I have been getting a lot of questions about where user data is stored and how it is synchronized within SharePoint 2007. This inspired me to write this blog post about User Profiles and the User Information List or UserInfo table. [...]]]></description>
			<content:encoded><![CDATA[<table border="2" align="center" cellpadding="5" cellspacing="0" style="background-color:#ff00ff;border:#000000 2px solid">
<tbody>
<tr>
<td>This blog has moved.&nbsp; <a href="http://www.sharepointchick.com/archive/2009/06/17/user-profiles-and-the-user-information-list-or-userinfo-table.aspx">Click here</a> to open this post on my new blog.</td>
</tr>
</tbody>
</table>
<p>&nbsp;&nbsp;</p>
<ul style="margin-top:0in;direction:ltr;margin-bottom:0in;margin-left:0.02in">
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">Lately I have been getting a lot of questions about where user data is stored and how it is synchronized within SharePoint 2007. This inspired me to write this blog post about <span style="color:#1f497d">U</span>ser <span style="color:#1f497d">P</span>rofiles and the <span style="color:#1f497d">U</span>ser <span style="color:#1f497d">I</span>nformation <span style="color:#1f497d">L</span>ist or UserInfo table. I will also do a future post on what happens when a user profile is deleted from MOSS 2007.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt;font-weight:bold">User Profiles</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">The user profile store in MOSS 2007 contains information about users. User profiles can be created by importing users from a user account directory, or they can be created manually. In most environments Active Directory will be used as the source for creating user profiles. In the MOSS 2007 Shared Service Provider an LDAP import query can be configured that will create user profiles for accounts that are returned from Active Directory by the LDAP query. The user profile imports can be scheduled to&nbsp; run on a regular basis and they can be either&nbsp; incremental or full.</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">Once a user profile is created additional information about the user can be added to the user profile properties by the user itself, an administrator, a Business Data Catalog data source or an LDAP directory.</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">By default data from user profiles is shown in the People Search results, on the My Site and in the User Information list of MOSS and WSS sites.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt;font-weight:bold">User Information List</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">All MOSS 2007 and WSS 3.0 sites have a user information list. The information in the user information list is stored in the UserInfo table in the content database of the site. A user gets added to the user information list&nbsp; when he or she has accesses the site for the first time. In the user information list a user&#39;s email address, login name and name are stored. MOSS will make sure that user profile property information for those fields for users that are added to the user information list is sen<span style="color:#1f497d">t</span> to the user </p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">information list.&nbsp; The image below shows an overview of the user profile architecture in MOSS 2007.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in"><a href="/oldweblogfiles/mirjam/UserProfileArchitecture.gif"><img src="/oldweblogfiles/mirjam/UserProfileArchitecture.gif" border="0" alt="  " /></a></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt;font-weight:bold">Synchronizing user profile data to the user information list</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">Keeping the information in the user information lists up to data is a task that is handled by the Profile Synchronization and the Quick Profile Synchronization timer jobs. By default the first job runs once every hour, the second one runs every couple of minutes and is incremental. The first time user data is replicated from the user profile to the user information list of a site a full update is needed. So the Profile Synchronization job needs to run in order to get the data replicated to the site and this may take up to an hour. If information about a user is already stored in the user information list and the information changes in the user profile it will be synchronized with the data in the site collection by the <span>&nbsp;</span>Quick Profile Synchronization job.</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in"><a href="/oldweblogfiles/mirjam/ProfileSyncJobs.jpg"><img height="220" width="650" src="/oldweblogfiles/mirjam/ProfileSyncJobs.jpg" border="0" alt="  " /></a></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">You can also kick off the profile synchronization jobs by running the stsadm sync command.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt"><span lang="nl">&nbsp;</span><span lang="en-US">stsadm -o sync</span></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">If you believe that information is not synced between the user profiles and the user information lists in one or more sites you can request a list of content databases that have not been synchronized for x number of days by using the following stsadm sync command. </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">stsadm -o sync -listolddatabases &lt;x number of days&gt;</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">If one or more content databases show up in this list you can clean up the sync list so they can be added to the list again.</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">stsadm -o sync -deleteolddatabases &lt;x number of days&gt;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">You can also use the sync command to change the schedule for the synchronization job. </p>
<p lang="en-US" style="margin:0in;font-family:Calibri;font-size:11pt">For more information on the stsadm sync command have a look here <a href="http://technet.microsoft.com/en-us/library/cc263196.aspx">http://technet.microsoft.com/en-us/library/cc263196.aspx</a>.</p>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/mirjam/2009/06/17/user-profiles-and-the-user-information-list-or-userinfo-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nintex context menu problem solved</title>
		<link>http://vspug.com/mirjam/2009/06/10/nintex-context-menu-problem-solved/</link>
		<comments>http://vspug.com/mirjam/2009/06/10/nintex-context-menu-problem-solved/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 08:57:00 +0000</pubDate>
		<dc:creator>Mirjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[


This blog has moved.&#160; Click here to open this post on my new blog.



&#160;
On our development environment at one of our customers we had a very weird problem with Nintex.
&#160;

For one of my colleagues Nintex worked perfectly
If I logged on to the server with my own account I could create or manage a workflow, but [...]]]></description>
			<content:encoded><![CDATA[<table border="2" align="center" cellpadding="5" cellspacing="0" style="background-color:#ff00ff;border:#000000 2px solid">
<tbody>
<tr>
<td>This blog has moved.&nbsp; <a href="http://www.sharepointchick.com/archive/2009/06/10/nintex-context-menu-problem-solved.aspx">Click here</a> to open this post on my new blog.</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">On our development environment at one of our customers we had a very weird problem with Nintex.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<ul style="margin-top:0in;direction:ltr;margin-bottom:0in;margin-left:0.375in">
<li><span style="font-family:Calibri;font-size:11pt">For one of my colleagues Nintex worked perfectly</span></li>
<li><span style="font-family:Calibri;font-size:11pt">If I logged on to the server with my own account I could create or manage a workflow, but if I added a new Workflow Action the context menu of that action wouldn&#39;t work. I couldn&#39;t configure<span>&nbsp; </span>or move the action.</span></li>
<li><span style="font-family:Calibri;font-size:11pt">If I tried changing a Workflow Action that was added to a workflow by my colleague the context menu worked fine.</span></li>
<li><span style="font-family:Calibri;font-size:11pt">If I logged onto the SharePoint environment using my colleagues account the context menu on new actions still didn&#39;t work.</span></li>
<li><span style="font-family:Calibri;font-size:11pt">If I logged onto the server using my colleagues account configuring actions worked without a problem.</span></li>
</ul>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">Knowing all this I knew it had to be something on the server itself and not something in the SharePoint environment.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">So I checked all permissions on the server, Internet Options in Internet Explorer, compatibility view settings (it&#39;s IE8), whether the site was in the Intranet Zone for both accounts..</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">After checking all that I still had the same problem.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">Today we added another development server to the same environment, connected to the same SharePoint environment. I browsed to the site on the new server and when adding a Nintex action I got the IE security popup asking me whether I wanted to add about:blank to my trusted sites. I did that and everything worked perfectly.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">Moral of this story:<span style="font-weight:bold"> if you are using Nintex workflows and the IE Enhanced Security Configuration (ESC)&nbsp;settings are turned on you need to add about:blank to your Trusted Sites</span>.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/mirjam/2009/06/10/nintex-context-menu-problem-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Microsoft Certified Master  experience</title>
		<link>http://vspug.com/mirjam/2009/04/08/the-microsoft-certified-master-experience/</link>
		<comments>http://vspug.com/mirjam/2009/04/08/the-microsoft-certified-master-experience/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 15:43:00 +0000</pubDate>
		<dc:creator>Mirjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[


This blog has moved.&#160; Click here to open this post on my new blog.



&#160;
Since a lot of people are interested in the Microsoft Certified Master (MCM) experience I&#39;m going to try and write a blog about it. Note that this will just be a post on how I experienced the program. I can&#39;t elaborate on [...]]]></description>
			<content:encoded><![CDATA[<table border="2" align="center" cellpadding="5" cellspacing="0" style="background-color:#ff00ff;border:#000000 2px solid">
<tbody>
<tr>
<td>This blog has moved.&nbsp; <a href="http://www.sharepointchick.com/archive/2009/04/08/the-microsoft-certified-master-experience.aspx">Click here</a> to open this post on my new blog.</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p lang="en-US">Since a lot of people are interested in the Microsoft Certified Master (MCM) experience I&#39;m going to try and write a blog about it. Note that this will just be a post on how I experienced the program. I can&#39;t elaborate on the actual content of the training, although I will blog on specific topics later on. </p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">It was great, very intense, so usefull, terrific, brutal, fantastic, fascinating, informative, overwhelming&hellip;</p>
<p lang="en-US">Ok, so it&#39;s very difficult to describe. I will give it a try.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">The group of students consisted of 16 SharePoint experts. All people that have a lot of experience in doing SharePoint implementations. Lots of them are also trainers and speakers. It&#39;s amazing to spend 3 weeks in a room with a group like that. We&#39;ve had a lot of great and very valuable discussions, since people do different types of projects and have come up with different best practices. We were all there to learn and everybody was more than willing to share their knowledge and experience. I really want to thank everybody for the great three weeks! </p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Working with the instructors was also very special. All of them are the best in the field on the area that they covered. They are not just trainers, but people that actually work with the product and have an amazing depth on the subject that they covered. It was a priviledge to be able to learn from their experience and to be able to bounce thoughts and ideas off of them.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">The training was conducted on the Microsoft Campus in Redmond. For me it was the first time that I was on campus and that really brought something extra to the experience. Being there also meant that it was possible for product team members to drop in when we were discussing a certain subject to elaborate even more, sometimes on the current version and sometimes on how things will change in vNext. Very valuable!</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">As I said before I can&#39;t say much about the actual content of the training, but I can say that it&#39;s very broad and very deep. It reaches from information architecture, capacity planning, infrastructure, SQL, a lot of SharePoint services (like Search, BDC etc), development and troubleshooting. All this material was covered in three weeks of training. That&#39;s a lot to cover in three weeks, which means that it&#39;s long days of instruction supplemented with hands on labs in the evening. It means that you eat, drink and breath SharePoint for three weeks. This is a stretch, but it&#39;s a great way to hugely expand your knowledge in a relatively short amount of time.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Of course your knowledge will also be tested. There are three written exams and one hands on qualification lab. These exams also take place during the three weeks. This means that the master program is not for the lazy and not for the faint<span>&nbsp; </span>hearted. </p>
<p lang="en-US">At the moment I know that I passed the three written exams. The results for the qualification lab are not in yet. Personally I&#39;m sceptical about me passing that one. But it really doesn&#39;t matter. I&#39;m very proud that I was part of the R2 (beta) MCM SharePoint group. And I&#39;m very proud to have passed at least three of the exams. If I haven&#39;t passed the qualification lab I will be able to retake it in a Microsoft office around here, so I don&#39;t need to travel to Redmond for that. </p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">[Update: I took the retake of the qualification lab and I passed! I&#39;m now officially and MCM SharePoint!]</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Even though this was a beta the program was very well organized. Off course there were a couple of small glitches along the way, but the whole experience is already pretty well polished. I personally think that we&#39;ve got the acting program manager to thank for that. He did an amazing job in managing content and logistics and watching out over all the candidates. He was terrific. Thank you.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">All in all the experience was great, I&#39;m still exhausted, but I wouldn&#39;t have want to miss it for anything in the world! </p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Some links to MCM related content:</p>
<p lang="en-US"><a target="_blank" href="http://www.microsoft.com/learning/mcp/master/SharePoint/default.mspx" title="Microsoft Certified Master: Microsoft Office SharePoint Server 2007">Microsoft Certified Master: Microsoft Office SharePoint Server 2007</a></p>
<p lang="en-US"><a target="_blank" href="/rhouberg/archive/2009/04/06/master-training-are-you-ready.aspx" title="Blogpost by Russ Houberg, MCM R2 attendee">Blogpost by Russ Houberg, MCM R2 attendee</a></p>
<p lang="en-US"><a target="_blank" href="http://harbar.net/archive/2008/11/21/Microsoft-Certified-Master-for-SharePoint.aspx" title="Blogpost by Spence Harbar, MCM R2 attendee (posted pre-MCM)">Blogpost by Spence Harbar, MCM R2 attendee (posted pre-R2)</a></p>
<p lang="en-US"><a target="_blank" href="http://andrewconnell.com/blog/archive/2008/11/20/Microsoft-Certification-Master-for-SharePoint--My-Involvement-in-Helping.aspx" title="Blogpost by Andrew Connell, MCM Instructor">Blogpost by Andrew Connel, MCM instructor</a></p>
<p lang="en-US"><a target="_blank" href="http://www.toddbaginski.com/blog/archive/2008/11/21/sharepoint-certified-master-an-inside-look.aspx" title="Blogpost by Todd Baginski, MCM instructor">Blogpost by Todd Baginski, MCM instructor</a></p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/mirjam/2009/04/08/the-microsoft-certified-master-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying your InfoPath Forms in a Web Part</title>
		<link>http://vspug.com/mirjam/2009/03/10/displaying-your-infopath-forms-in-a-web-part/</link>
		<comments>http://vspug.com/mirjam/2009/03/10/displaying-your-infopath-forms-in-a-web-part/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 09:18:00 +0000</pubDate>
		<dc:creator>Mirjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[


This blog has moved.&#160; Click here to open this post on my new blog.



So here I am again with another &#34;did you know&#34;. This one is also inspired by Inside Microsoft Office SharePoint&#160; Server 2007.Did you know that you&#160; can display browser enabled InfoPath forms in a web part?
If you create a form that is [...]]]></description>
			<content:encoded><![CDATA[<table border="2" align="center" cellpadding="5" cellspacing="0" style="background-color:#ff00ff;border:#000000 2px solid">
<tbody>
<tr>
<td>This blog has moved.&nbsp; <a href="http://www.sharepointchick.com/archive/2009/03/10/displaying-your-infopath-forms-in-a-web-part.aspx">Click here</a> to open this post on my new blog.</td>
</tr>
</tbody>
</table>
<p><span lang="EN-US">So here I am again with another &quot;did you know&quot;. This one is also inspired by Inside Microsoft Office SharePoint<span>&nbsp; </span>Server 2007.<br /></span><span lang="EN-US">Did you know that you<span>&nbsp; </span>can display browser enabled InfoPath forms in a web part?</span></p>
<p><span lang="EN-US">If you create a form that is published to the SharePoint Form Services in the Central Administration and you have selected that users can open the form in their browsers, you can display the form in a web part. This means that the form page will get a SharePoint look and feel, instead of an InfoPath look and feel.</span></p>
<p><span lang="EN-US"></span></p>
<p><span lang="EN-US">It is easy to configure and you don&#39;t need a single line of code.</span></p>
<p><span lang="EN-US"></span></p>
<p><span lang="EN-US">The web part that is able to show the form is already created for you by Microsoft and is part of the Microsoft.Office.InfoPath.Server.dll assembly. This assembly is stored in the C:Program FilesMicrosoft Office Servers12.0Bin folder. </span></p>
<p><span lang="EN-US"></span></p>
<p><span lang="EN-US">The first step you have to take to enable the web part to show you InfoPath page is to add a SafeControl entry to the web.config of the web application where you want to use the web part.<br /></span><span lang="EN-US">The SafeControl entry should look like this:<br /></span><span lang="EN-US">&lt;SafeControl Assembly=&quot;Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot; Namespace=&quot;Microsoft.Office.InfoPath.Server.Controls&quot; Typename=&quot;XmlFormView&quot; Safe=&quot;True&quot; /&gt;</span></p>
<p><span lang="EN-US">Now go to your browser and open the Web Part Gallery from the Site Settings page of your SharePoint environment. Click on the New button and you will get a list of available web parts. Look for the entry Microsoft.Office.InfoPath.Server.Controls.XmlFormView and check the checkbox in front of it. Next click the Populate Gallery button at the top of the page. The web part should now be available for use in the site collection.</span></p>
<p><span lang="EN-US"></span></p>
<p><span lang="EN-US">You can check this by going to a web part page within your site collection and click Edit Page from the site actions menu. In the page click on the Add a Web Part link of a web part section. Now choose the XmlFormView web part that can be found under the Miscellaneous section. An error is generated because you still need to set some properties for the web part. You can simply close the error and go to the properties of the web part to set them. </span></p>
<p><span lang="EN-US">Go to the<span>&nbsp; </span>Features section at the bottom of the properties list. Expand the section and decide whether you want to display the header and the footer of the form. Since the form is displayed in the middle of the page you probably don&#39;t! If you want users to be able to fill in the form in the web part you want to set the EditingStatus to Editing. In the DataBinding section you find the XsnLocation, the XmlLocation and the possible path to the container where you want to save the form to. </span></p>
<p><span lang="EN-US">If you are displaying a blank form you want to have the XsnLocation pointing to the location where the .xsn file of you form is published to. <br /></span><span lang="EN-US">If you are displaying an existing form you can have the XmlLocation point to the location of that form. <br /></span><span lang="EN-US"><br />If you have filled in these properties correctly your web part should now be displaying you form!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/mirjam/2009/03/10/displaying-your-infopath-forms-in-a-web-part/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Stemming for MOSS 2007 Search</title>
		<link>http://vspug.com/mirjam/2009/03/10/use-stemming-for-moss-2007-search/</link>
		<comments>http://vspug.com/mirjam/2009/03/10/use-stemming-for-moss-2007-search/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 09:14:00 +0000</pubDate>
		<dc:creator>Mirjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[


This blog has moved.&#160; Click here to open this post on my new blog.



While I was reading Inside Microsoft Office SharePoint&#160; Server 2007 as a to prepare for the Master Program, I came across something interesting again. 
In the Search Core Results Web Part you can enable stemming. If you are a non-English reader you [...]]]></description>
			<content:encoded><![CDATA[<table border="2" align="center" cellpadding="5" cellspacing="0" style="background-color:#ff00ff;border:#000000 2px solid">
<tbody>
<tr>
<td>This blog has moved.&nbsp; <a href="http://www.sharepointchick.com/archive/2009/03/10/use-stemming-for-moss-2007-search.aspx">Click here</a> to open this post on my new blog.</td>
</tr>
</tbody>
</table>
<p><span lang="EN-US">While I was reading Inside Microsoft Office SharePoint<span>&nbsp; </span>Server 2007 as a to prepare for the Master Program, I came across something interesting again. </span></p>
<p><span lang="EN-US">In the Search Core Results Web Part you can enable stemming. If you are a non-English reader you probably wonder what stemming is, as I did when I read about it. Stemming is a method of mapping a linguistic stem to all matching words to increase the number of relevant results. This means that if searching for buy, you will also find results that contain bought, buying and buys. For Dutch readers: het betekent dus dat je ook vervoegingen vindt van woorden waar je op zoekt.</span></p>
<p><span lang="EN-US">Very handy!</span></p>
<p><span lang="EN-US">Stemming is disabled by default, but can be enabled in the properties of the Search Core Results Web Part.</span></p>
<p><span lang="EN-US">You can also use stemming if you are using the Query class from the Microsoft.Office.Server.Search.dll assembly. The query class has a property EnableStemming that you can use to turn stemming on or off. Note that the query class also has a property Culture that is very relevant when using Stemming, so the query engine knows in what language it has to look for stem matches of the search term.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/mirjam/2009/03/10/use-stemming-for-moss-2007-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slides van DIWUG presentaties van dinsdag 17 februari</title>
		<link>http://vspug.com/mirjam/2009/02/19/slides-van-diwug-presentaties-van-dinsdag-17-februari/</link>
		<comments>http://vspug.com/mirjam/2009/02/19/slides-van-diwug-presentaties-van-dinsdag-17-februari/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 12:15:00 +0000</pubDate>
		<dc:creator>Mirjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[


This blog has moved.&#160; Click here to open this post on my new blog.



Dinsdagavond (17 februari) was de eerste DIWUG avond van dit jaar. Ondanks de late uitnodiging was de opkomst erg goed, er waren meer dan 50 bezoekers!De avond werd gehost bij en gesponsord door Sparked. We hadden weer twee presentaties:

Serge van den Oever [...]]]></description>
			<content:encoded><![CDATA[<table border="2" align="center" cellpadding="5" cellspacing="0" style="background-color:#ff00ff;border:#000000 2px solid">
<tbody>
<tr>
<td>This blog has moved.&nbsp; <a href="http://www.sharepointchick.com/archive/2009/02/19/slides-van-diwug-presentaties-van-dinsdag-17-februari.aspx">Click here</a> to open this post on my new blog.</td>
</tr>
</tbody>
</table>
<p>Dinsdagavond (17 februari) was de eerste DIWUG avond van dit jaar. Ondanks de late uitnodiging was de opkomst erg goed, er waren meer dan 50 bezoekers!<br />De avond werd gehost bij en gesponsord door Sparked. <br />We hadden weer twee presentaties:</p>
<ul>
<li>Serge van den Oever van Macaw hield een presentatie over Business Productivity Online Suite. Zijn slides staan <a target="_blank" href="http://cid-0ddc65de8785e94e.skydrive.live.com/self.aspx/Public/mpdc-bpos%20-%20DIWUG20090217.pdf" title="Slides van Serge over BPOS">hier</a>, en Serge heeft zelf ook een <a target="_blank" href="http://weblogs.asp.net/soever/archive/2009/02/18/presentation-on-the-business-productivity-online-suite-as-given-at-diwug.aspx" title="Blogpost van Serge over BPOS presentatie voor de DIWUG">blogpost over de presentatie</a> geschreven met links naar andere interessante resources.</li>
<li>Clemens Reijnen van Sogeti presenteerde over Collaboration in the Cloud. Zijn slides zijn <a target="_blank" href="http://cid-53de99fbe1833540.skydrive.live.com/browse.aspx/Public" title="Slides van Clemens over Collaboration in the Cloud">hier</a> te vinden.</li>
</ul>
<p>Ik wil hiervandaan graag Sparked bedanken voor de goed georganiseerde avond en de sprekers bedanken voor hun inbreng. Daarnaast natuurlijk iedereen die er was bedankt voor de komst!<br />We hopen op korte termijn uitsluitsel te kunnen geven over de data en de onderwerpen van de volgende DIWUG avond. </p>
<p>Tot die tijd is iedereen natuurlijk van harte welkom bij de SDE van maart op 30 maart in Driebergen. Meer informatie over de komende SDE kun je <a target="_blank" href="http://www.sdn.nl/SDN/SDNEvent/tabid/68/Default.aspx" title="Meer informatie over de SDE van 30 maart">hier</a> vinden.</p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/mirjam/2009/02/19/slides-van-diwug-presentaties-van-dinsdag-17-februari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading UserControls in SharePoint web parts</title>
		<link>http://vspug.com/mirjam/2009/02/11/using-usercontrols-in-sharepoint-web-parts/</link>
		<comments>http://vspug.com/mirjam/2009/02/11/using-usercontrols-in-sharepoint-web-parts/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:30:00 +0000</pubDate>
		<dc:creator>Mirjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[


This blog has moved.&#160; Click here to open this post on my new blog.



&#160;
If you want to use UserControls in SharePoint web parts you can use SmartPart (http://www.codeplex.com/smartpart). But you can also build a web part that load a UserControl yourself.
&#160;
If you want to do it yourself you start out by opening Visual Studio (whether [...]]]></description>
			<content:encoded><![CDATA[<table border="2" align="center" cellpadding="5" cellspacing="0" style="background-color:#ff00ff;border:#000000 2px solid">
<tbody>
<tr>
<td>This blog has moved.&nbsp; <a href="http://www.sharepointchick.com/archive/2009/02/11/using-usercontrols-in-sharepoint-web-parts.aspx">Click here</a> to open this post on my new blog.</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p lang="en-US">If you want to use UserControls in SharePoint web parts you can use SmartPart (<a href="http://www.codeplex.com/smartpart">http://www.codeplex.com/smartpart</a>). But you can also build a web part that load a UserControl yourself.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">If you want to do it yourself you start out by opening Visual Studio (whether you use 2005 or 2008 doesn&#39;t matter). Next you create a new project of the type &quot;ASP.NET Web Application&quot;.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US"><a href="/oldweblogfiles/mirjam/CreateWebApplication.jpg"><img border="0" src="/oldweblogfiles/mirjam/CreateWebApplication.jpg" alt="  " /></a></p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Then you can add a new class to the project and you make sure that it inherits from System.Web.UI.WebControls.WebParts.WebPart. </p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US"><a href="/oldweblogfiles/mirjam/WebPartInheritance.jpg"><img border="0" src="/oldweblogfiles/mirjam/WebPartInheritance.jpg" alt="  " /></a></p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Now create an new folder in the project that you call &quot;Usercontrols&quot; and add a Web User Control to it.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US"><a href="/oldweblogfiles/mirjam/UserControlVirtualPath.jpg"></a></p>
<p lang="en-US"><a href="/oldweblogfiles/mirjam/CreateUserControl.jpg"><img border="0" src="/oldweblogfiles/mirjam/CreateUserControl.jpg" alt="  " /></a>&nbsp;</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Make sure that you adjust the Inheritance of your .ascx file to a fully qualified name.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">&nbsp;<img border="0" src="/oldweblogfiles/mirjam/FullyQualifiedName.jpg" alt="  " /><a href="/oldweblogfiles/mirjam/FullyQualifiedName.jpg"></a><a href="/oldweblogfiles/mirjam/FullyQualifiedName.jpg"></a><a href="/oldweblogfiles/mirjam/FullyQualifiedName.jpg"></a><a href="/oldweblogfiles/mirjam/WebPartInheritance.jpg"></a></p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Let&#39;s go back to the class you created initially and add the user control to it. You add the user control in the CreateChildControls function.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US"><a href="/oldweblogfiles/mirjam/CreateChildControls.jpg"><img border="0" src="/oldweblogfiles/mirjam/CreateChildControls.jpg" alt="  " /></a></p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">You can see that the function UserControlVirtualPath is called. This function is used to determine where the user control will be located. Reason for this is that the deployment location of the user control changes when you change the location where the assembly is deployed to.</p>
<p lang="en-US">If you deploy the assembly to the GAC the user control will be stored in the C:Program FilesCommon FilesMicrosoft Sharedweb server extensionswpresources folder and will have the fully qualified name used to create sub folders. The user control for my project will be stored in C:Program FilesCommon FilesMicrosoft Sharedweb server extensionswpresourcesTwitterTimelineWebPart1.0.0.0__c038812e8af423a0TwitterPublicTimelineUserControls if I deploy the assembly to the GAC.</p>
<p lang="en-US">If I were to deploy the assembly to the bin of the web application the user control is deployed to the C:InetpubwwwrootwssVirtualDirectoriesmoss2007devwpresources folder.</p>
<p lang="en-US">The UserControlVirtualPath function finds the location of the user control for you. </p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US"><a href="/oldweblogfiles/mirjam/UserControlVirtualPath.jpg"><img border="0" src="/oldweblogfiles/mirjam/UserControlVirtualPath.jpg" alt="  " /></a></p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">You can add all the content you like to the user control now. Nothing special about that. </p>
<p lang="en-US">One thing that we need to take care of that is SharePoint specific is the deployment.</p>
<p lang="en-US">I will do it manually, so everyone can copy this.</p>
<p lang="en-US">You start out be creating a .ddf file that will help you create the package. The .ddf file can be stored in the root folder of your project.<span>&nbsp; </span>I will call the file SolutionPackage.ddf. More information about creating the ddf file can be found here (<a href="http://msdn.microsoft.com/en-us/library/bb466225.aspx">http://msdn.microsoft.com/en-us/library/bb466225.aspx</a>).</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US"><a href="/oldweblogfiles/mirjam/ddffile.jpg"><img border="0" src="/oldweblogfiles/mirjam/ddffile.jpg" alt="  " /></a></p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Next you need to create the manifest.xml file that will make sure that all files are deployed correctly. Create a folder &quot;DeploymentFiles&quot; and create a file that you call manifest.xml in it. </p>
<p lang="en-US">In the manifest you will have to create an Assemblies element with a child Assembly element in which you will specify the assembly you want to deploy. The property DeploymentTarget indicates whether the assembly will be deployed to the GAC or to the web application bin. If you want to deploy the assembly to the GAC the DeploymentTarget property needs to be GlobalAssemblyCache. If you would like to deploy to the bin of the web application you would use WebApplication. </p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">The ClassResources element is a child<span>&nbsp; </span>element of the assembly element and will have a child element ClassResource. You will need to fill in the location of the resource file (the .ascx file) in the package in the FileName property. The Location property is used to indicate the folder that the resource file will be deployed to. In this case we will create a sub folder TwitterPublicTimeline with a sub folder </p>
<p lang="en-US">UserControls to store the user control in.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">The Assembly element has another child element called SafeControls. The child element SafeControl is used to create the safecontrol entries in the web.config. You will need to add the information about your assembly in the Assembly, Namespace and TypeName properties. The Safe property should be set to True..that was the whole point right?</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US"><a href="/oldweblogfiles/mirjam/manifestfile.jpg"><img border="0" src="/oldweblogfiles/mirjam/manifestfile.jpg" alt="  " /></a></p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">A great reference that describes the schema of the manifest file is located here (<a href="http://msdn.microsoft.com/en-us/library/ms442108.aspx">http://msdn.microsoft.com/en-us/library/ms442108.aspx</a>).</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">After creating the ddf and the manifest files you start a command prompt and go to the folder where your ddf file is stored. You can then type &quot;makecab /f SolutionPackage.ddf&quot;.</p>
<p lang="en-US">This will create the wsp package and include the files mentioned in the ddf file, including the manifest file.</p>
<p lang="en-US">If you want to check whether all files are actually in the package you copy the .wsp file and rename it to a .cab file. Then you extract it and check whether all files are in there.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Now you are ready to upload you .wsp file to your SharePoint environment. You can use the stsadm addsolution command for that.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US"><a href="/oldweblogfiles/mirjam/addsolution.jpg"><img border="0" src="/oldweblogfiles/mirjam/addsolution.jpg" alt="  " /></a></p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">After that you can go your Central Administration and deploy the solution to your web application. The Solution Management page can be found on the Operations page under the Global Configuration heading.</p>
<p lang="en-US">Click on the solution name and on the Deploy Solution link. Now select the web application you want to deploy the web part to and the time at which you want the deployment to run.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Your web part is now deployed. You will only need to add it to the web part gallery of your site collection be browsing to the site settings page of your site collection and select Web Parts under Galleries. Click New and select the dll of your web part. Scroll back to the top of the page and click the &quot;Populate Gallery&quot; button.</p>
<p lang="en-US">Congratulations! You can now add your web part to a web part page!</p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/mirjam/2009/02/11/using-usercontrols-in-sharepoint-web-parts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
