<?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>SharePointBlog.nl</title>
	<atom:link href="http://www.sharepointblog.nl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sharepointblog.nl</link>
	<description>Michiel Lankamp</description>
	<lastBuildDate>Wed, 26 May 2010 09:37:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>FullTextSqlQuery Exception from HRESULT: 0x80040E60</title>
		<link>http://www.sharepointblog.nl/2010/05/25/fulltextsqlquery-exception-from-hresult-0x80040e60/</link>
		<comments>http://www.sharepointblog.nl/2010/05/25/fulltextsqlquery-exception-from-hresult-0x80040e60/#comments</comments>
		<pubDate>Tue, 25 May 2010 22:09:16 +0000</pubDate>
		<dc:creator>Michiel</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Exception]]></category>
		<category><![CDATA[FullTextSqlQuery]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://www.sharepointblog.nl/?p=52</guid>
		<description><![CDATA[After upgrading a webpart from SharePoint 2007 to 2010 I got a exception from de search engine about the query format. I used the following code: var sqlQuery = new FullTextSqlQuery(SPContext.Current.Site); sqlQuery.ResultTypes = ResultType.RelevantResults; sqlQuery.TrimDuplicates = false; sqlQuery.QueryText = "SELECT Path, Title FROM scope() ORDER BY Title"; // Return the search results to a ResultTableCollection. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2010%2F05%2F25%2Ffulltextsqlquery-exception-from-hresult-0x80040e60%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2010%2F05%2F25%2Ffulltextsqlquery-exception-from-hresult-0x80040e60%2F&amp;source=m_lampje&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>After upgrading a webpart from SharePoint 2007 to 2010 I got a exception from de search engine about the query format. I used the following code:</p>
<pre class="csharpcode">var sqlQuery = <span class="kwrd">new</span> FullTextSqlQuery(SPContext.Current.Site);
sqlQuery.ResultTypes = ResultType.RelevantResults;
sqlQuery.TrimDuplicates = <span class="kwrd">false</span>;
sqlQuery.QueryText = <span class="str">"SELECT Path, Title FROM scope() ORDER BY Title"</span>;

<span class="rem">// Return the search results to a ResultTableCollection.</span>
var results = sqlQuery.Execute();</pre>
<p>When I debugged the code I found out that the ORDER BY clause was causing the problem. When I used a integer or date managed property in the order by clause the problem disappeared. I started investigating the options for text managed properties, in the properties for a managed property I found a new option:</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.sharepointblog.nl/wp-content/uploads/2010/05/image1.png" border="0" alt="image" width="499" height="31" /></p>
<p>The explanation for this option is:</p>
<blockquote><p>To reduce storage requirements, new text properties are automatically treated as a hash which limits comparisons <strong>(including sorting</strong>) to equality/inequality.  Unselect this option to enable other types of comparisons (less than, greater than, order by).</p></blockquote>
<p><span style="color: #666666;">When I enabled this option and started a full-crawl the problems are gone. In my opinion the error message should have been a bit more clearer.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointblog.nl/2010/05/25/fulltextsqlquery-exception-from-hresult-0x80040e60/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FieldRefs not working with XML comments</title>
		<link>http://www.sharepointblog.nl/2010/05/25/fieldrefs-not-working-with-xml-comments/</link>
		<comments>http://www.sharepointblog.nl/2010/05/25/fieldrefs-not-working-with-xml-comments/#comments</comments>
		<pubDate>Tue, 25 May 2010 20:55:44 +0000</pubDate>
		<dc:creator>Michiel</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[contentype]]></category>
		<category><![CDATA[fields]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.sharepointblog.nl/?p=44</guid>
		<description><![CDATA[After provisioning a custom content type it contained no custom fields. After investigation the problem was found in the SharePoint xml parser, it can't handle xml comments.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2010%2F05%2F25%2Ffieldrefs-not-working-with-xml-comments%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2010%2F05%2F25%2Ffieldrefs-not-working-with-xml-comments%2F&amp;source=m_lampje&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Today I was working on a SharePoint 2010 project where the custom fields and content types where provisioned using a feature. After the feature was activated the custom fields and content types where provisioned in SharePoint, except the content type contained no fields. The element manifest file contained the following xml:</p>
<pre class="csharpcode">  <span class="rem">&lt;!-- Base Page --&gt;</span>
<span class="kwrd">&lt;</span><span class="html">ContentType</span> <span class="attr">ID</span><span class="kwrd">="0x010100C568DB52D9D0A1...84E219954237AF3901"</span>
              <span class="attr">Name</span><span class="kwrd">="Basepage"</span>
              <span class="attr">Description</span><span class="kwrd">="Basepage"</span>
              <span class="attr">Group</span><span class="kwrd">="Publishing"</span>
              <span class="attr">Sealed</span><span class="kwrd">="TRUE"</span>
              <span class="attr">Inherits</span><span class="kwrd">="TRUE"</span>
              <span class="attr">Version</span><span class="kwrd">="1"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">FieldRefs</span><span class="kwrd">&gt;</span>
    <span class="rem">&lt;!-- Originating from MOSS --&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">FieldRef</span> <span class="attr">ID</span><span class="kwrd">="{b66e9b50-a28e-469b-b1a0-af0e45486874}"</span>
            <span class="attr">Name</span><span class="kwrd">="Keywords"</span> <span class="kwrd">/&gt;</span>
    <span class="rem">&lt;!-- Custom fields --&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">FieldRef</span> <span class="attr">ID</span><span class="kwrd">="{30607e4e-a3e1-4662-9766-56e1faedb875}"</span>
            <span class="attr">Name</span><span class="kwrd">="AdminComments"</span> <span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">FieldRefs</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">ContentType</span><span class="kwrd">&gt;</span></pre>
<p>The ULS logs showed no errors and I couldn’t figure out what the problem was because the same element manifest file was used in SharePoint 2007. After the stripping the file I figured out that the xml comments were causing the problem. Now my element manifest contains the following:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">ContentType</span> <span class="attr">ID</span><span class="kwrd">="0x010100C568DB52D9D0A1...84E219954237AF3901"</span>
              <span class="attr">Name</span><span class="kwrd">="Basepage"</span>
              <span class="attr">Description</span><span class="kwrd">="Basepage"</span>
              <span class="attr">Group</span><span class="kwrd">="Publishing"</span>
              <span class="attr">Sealed</span><span class="kwrd">="TRUE"</span>
              <span class="attr">Inherits</span><span class="kwrd">="TRUE"</span>
              <span class="attr">Version</span><span class="kwrd">="1"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">FieldRefs</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">FieldRef</span> <span class="attr">ID</span><span class="kwrd">="{b66e9b50-a28e-469b-b1a0-af0e45486874}"</span>
            <span class="attr">Name</span><span class="kwrd">="Keywords"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">FieldRef</span> <span class="attr">ID</span><span class="kwrd">="{30607e4e-a3e1-4662-9766-56e1faedb875}"</span>
            <span class="attr">Name</span><span class="kwrd">="AdminComments"</span> <span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">FieldRefs</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">ContentType</span><span class="kwrd">&gt;</span></pre>
<p>The content is the same except the comments are missing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointblog.nl/2010/05/25/fieldrefs-not-working-with-xml-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SearchBox changed in October Cumulative Update</title>
		<link>http://www.sharepointblog.nl/2010/01/28/searchbox-changed-in-october-cumulative-update/</link>
		<comments>http://www.sharepointblog.nl/2010/01/28/searchbox-changed-in-october-cumulative-update/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 16:48:15 +0000</pubDate>
		<dc:creator>Michiel</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[Multilingual]]></category>
		<category><![CDATA[October update]]></category>
		<category><![CDATA[ScopeDisplayGroupName]]></category>
		<category><![CDATA[SearchBoxEx]]></category>

		<guid isPermaLink="false">http://www.sharepointblog.nl/2010/01/28/searchbox-changed-in-october-cumulative-update/</guid>
		<description><![CDATA[The problem With the introduction of the October Cumulative Update for SharePoint 2007 I encountered a problem with the search box on multilingual sites. After the installation of the update the scopes dropdown list always uses the same scope display group. After investigation I found that the language of the root web is used to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2010%2F01%2F28%2Fsearchbox-changed-in-october-cumulative-update%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2010%2F01%2F28%2Fsearchbox-changed-in-october-cumulative-update%2F&amp;source=m_lampje&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<h3>The problem</h3>
<p>With the introduction of the October Cumulative Update for SharePoint 2007 I encountered a problem with the search box on multilingual sites. After the installation of the update the scopes dropdown list always uses the same scope display group. After investigation I found that the language of the root web is used to determine the scope display group.</p>
<h3>The cause</h3>
<p>This behavior was not present in the control prior to the October update, in the description of the update (KB975731) we found:</p>
<blockquote><p>&quot;All sites,&quot; &quot;People,&quot; and &quot;This site&quot; search scopes are available only for English language sites. Sites that are written in other languages show only the &quot;This site&quot; search scope.</p>
</blockquote>
<p>This explains that the control has been changed in this update.</p>
<h3>The reason</h3>
<p>Before the October Update the property ScopeDisplayGroupName is set in the constructor of the SearchBoxEx control:</p>
<pre class="csharpcode"><span class="kwrd">this</span>._ScopeDisplayGroupName =
    SearchCommon.GetLocResourceString(
        LocStringId.ScopeDisplayGroup_SearchDropdown_Name);</pre>
<p>In the October Update this line of code has been changed to:</p>
<pre class="csharpcode"><span class="kwrd">this</span>._ScopeDisplayGroupName = GetScopeDisplayGroupNameDefaultValue();</pre>
</p>
<p>This function uses the language from the root web is to determine the value for the ScopeDisplayGroupName property:</p>
<pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">static</span> <span class="kwrd">string</span> GetScopeDisplayGroupNameDefaultValue()
{
    <span class="kwrd">if</span> (SPContext.Current != <span class="kwrd">null</span>)
    {
        <span class="kwrd">while</span> (SPContext.Current.Site != <span class="kwrd">null</span>)
        {
            <span class="typ">CultureInfo</span> siteCollectionCulture = <span class="kwrd">null</span>;
            SPSecurity.RunWithElevatedPrivileges(<span class="kwrd">delegate</span> {
                siteCollectionCulture = <span class="kwrd">new</span> CultureInfo(
                    (<span class="kwrd">int</span>) SPContext.Current.Site.RootWeb.Language);
            });
            <span class="kwrd">return</span> StringResourceManager.GetString(
                LocStringId.ScopeDisplayGroup_SearchDropdown_Name,
                    siteCollectionCulture);
        }
    }

    <span class="kwrd">return</span> SearchCommon.GetLocResourceString(
            LocStringId.ScopeDisplayGroup_SearchDropdown_Name);
}</pre>
<h3>The solution</h3>
<p>For this website I want the value for the ScopeDisplayGroupName property to be based on the culture of the current web. To re-enable this functionality we updated our custom master page and added the following to the SearchBoxEx control:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">sharepoint:searchboxex</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span> ...
 <span class="attr">ScopeDisplayGroupName</span><span class="kwrd">=&quot;&lt;%$Resources:searchfix,ScopeDisplayGroup_SearchDropdown_Name%&gt;&quot;</span> <span class="kwrd">/&gt;</span></pre>
<p>In the App_GlobalResources I added custom resource files with the correct translations for the resource key ScopeDisplayGroup_SearchDropdown_Name.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointblog.nl/2010/01/28/searchbox-changed-in-october-cumulative-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customize SearchBoxEx</title>
		<link>http://www.sharepointblog.nl/2007/10/16/customize-searchboxex/</link>
		<comments>http://www.sharepointblog.nl/2007/10/16/customize-searchboxex/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 22:52:54 +0000</pubDate>
		<dc:creator>Michiel</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[SearchBoxEx]]></category>

		<guid isPermaLink="false">http://www.sharepointblog.nl/?p=29</guid>
		<description><![CDATA[A external company made a design for a Internet facing website, in the design the search control was made up in to rows. So my first idea was to create a new controltemplate for the SmallSearchInputBox, but then I realized that in moss the search-control isn&#8217;t a controltemplate anymore (in WSS it is). The searchbox [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2007%2F10%2F16%2Fcustomize-searchboxex%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2007%2F10%2F16%2Fcustomize-searchboxex%2F&amp;source=m_lampje&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>A external company made a design for a Internet facing website, in the design the search control was made up in to rows. So my first idea was to create a new controltemplate for the SmallSearchInputBox, but then I realized that in moss the search-control isn&#8217;t a controltemplate anymore (in WSS it is). The searchbox in MOSS is a control called <a href="http://msdn2.microsoft.com/ms518994.aspx" target="_blank">SearchBoxEx</a>, and this has some properties for the layout of the control. But is always renders the output as a table with 1 row, so my problem was how to render is in 2 rows using divs. Google didn&#8217;t provide me with an answer, so is started coding myself (I don&#8217;t want to create a new control with all logic, I just want reuse all the logic of SearchBoxEx and provide new render logic).</p>
<p>I finally found a way to do this, I just create an new control that inherits from SearchBoxEx. My custom look-and-feel can be done used an override of the CreateChildControls:<br />
<!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode"><span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> CreateChildControls( )
{
    <span class="kwrd">base</span>.CreateChildControls( );

    <span class="kwrd">if</span> ( Controls.Count &lt; 2 )
    {
        <span class="kwrd">return</span>;
    }

    HyperLinkLoc hlink = <span class="kwrd">null</span>;
    <span class="kwrd">if</span> ( Controls[ 1 ].GetType( ) == <span class="kwrd">typeof</span> ( Table ) )
    {
        Table tabel = ( Table ) Controls[ 1 ];

        <span class="rem">// Loop through cells to find the go button</span>
        <span class="kwrd">foreach</span> ( TableCell cell <span class="kwrd">in</span> tabel.Rows[ 0 ].Cells )
        {
            <span class="kwrd">if</span> ( cell.Controls.Count &gt; 0 )
            {
                <span class="kwrd">if</span> ( cell.Controls[ 0 ].GetType( ) == <span class="kwrd">typeof</span> ( HyperLinkLoc ) )
                {
                    hlink = ( HyperLinkLoc ) cell.Controls[ 0 ];
                }
            }
        }
        tabel.Visible = <span class="kwrd">false</span>;</pre>
<p>I first call the base.CreateChildControls to have SearchBoxEx create all the controls based on the properties set. Then I start looping through the tablecells to find the Go-button, the other controls (textbox &amp; dropdownlist) are available as protected members. After the go-button has been found, I set the table to invisible. Now that I have a reference to the controls I can start building my own look-and-feel:<br />
<!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">        <span class="kwrd">if</span> ( m_searchKeyWordTextBox != <span class="kwrd">null</span> )
        {
            HtmlGenericControl div = <span class="kwrd">new</span> HtmlGenericControl( <span class="str">"div"</span> );
            div.Attributes.Add( <span class="str">"class"</span>, <span class="str">"ms-sbcell"</span> );
            m_searchKeyWordTextBox.Style.Clear( ); <span class="rem">// remove the width style, done in css</span>
            div.Controls.Add( m_searchKeyWordTextBox );
            Controls.Add( div );
        }

        <span class="kwrd">if</span> ( hlink != <span class="kwrd">null</span> )
        {
            HtmlGenericControl div3 = <span class="kwrd">new</span> HtmlGenericControl( <span class="str">"div"</span> );
            div3.Attributes.Add( <span class="str">"class"</span>, <span class="str">"ms-sbgo ms-sbcell"</span> );
            div3.Controls.Add( hlink );
            Controls.Add( div3 );
        }

        <span class="kwrd">if</span> ( m_ddlScopes != <span class="kwrd">null</span> )
        {
            HtmlGenericControl div2 = <span class="kwrd">new</span> HtmlGenericControl( <span class="str">"div"</span> );
            div2.Attributes.Add( <span class="str">"class"</span>, <span class="str">"ms-sbscopes ms-sbcell"</span> );
            div2.Controls.Add( m_ddlScopes );
            Controls.Add( div2 );
        }
    }
}</pre>
<p>Download source: <a href="http://www.sharepointblog.nl/wp-content/uploads/2007/10/searchbox.cs" target="_blank">searchbox</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointblog.nl/2007/10/16/customize-searchboxex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>VariationSettings Import/Export Utility on Codeplex</title>
		<link>http://www.sharepointblog.nl/2007/10/14/variationsettings-importexport-utility-on-codeplex/</link>
		<comments>http://www.sharepointblog.nl/2007/10/14/variationsettings-importexport-utility-on-codeplex/#comments</comments>
		<pubDate>Sun, 14 Oct 2007 23:27:53 +0000</pubDate>
		<dc:creator>Michiel</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[codeplex]]></category>
		<category><![CDATA[variations]]></category>

		<guid isPermaLink="false">http://www.sharepointblog.nl/?p=25</guid>
		<description><![CDATA[I have completed my application for import/export of variations, I have uploaded everything to codeplex so have a look there: http://www.codeplex.com/variationsettings A neat little command utility that lets you do three things: - Export the current variationsettings and labels to xml - Import the variationsettings and label from xml - EXPERIMENTAL: create the variation hierachies [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2007%2F10%2F14%2Fvariationsettings-importexport-utility-on-codeplex%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2007%2F10%2F14%2Fvariationsettings-importexport-utility-on-codeplex%2F&amp;source=m_lampje&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I have completed my application for import/export of variations, I have uploaded everything to codeplex so have a look there:</p>
<p><a href="http://www.codeplex.com/variationsettings">http://www.codeplex.com/variationsettings</a></p>
<p>A neat little command utility that lets you do three things:<br />
- Export the current variationsettings and labels to xml<br />
- Import the variationsettings and label from xml<br />
- EXPERIMENTAL: create the variation hierachies</p>
<p>Background<br />
This application was created to extend our daily buildprocess for a public internet website</p>
<p>More Information<br />
Check out Michiel Lankamp&#8217;s blog entry: <a href="http://www.sharepointblog.nl/2007/10/14/variationsettings-importexport-utility-on-codeplex/">http://www.sharepointblog.nl/2007/10/14/variationsettings-importexport-utility-on-codeplex/</a></p>
<p>Want the code?<br />
Get it from <a href="http://www.codeplex.com/variationsettings/SourceControl/ListDownloadableCommits.aspx">http://www.codeplex.com/variationsettings/SourceControl/ListDownloadableCommits.aspx</a></p>
<p>Want the build?<br />
Get it from <a href="http://www.codeplex.com/variationsettings/Release/ProjectReleases.aspx">http://www.codeplex.com/variationsettings/Release/ProjectReleases.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointblog.nl/2007/10/14/variationsettings-importexport-utility-on-codeplex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable variations programmatically</title>
		<link>http://www.sharepointblog.nl/2007/10/14/enable-variations-programmatically/</link>
		<comments>http://www.sharepointblog.nl/2007/10/14/enable-variations-programmatically/#comments</comments>
		<pubDate>Sun, 14 Oct 2007 22:07:35 +0000</pubDate>
		<dc:creator>Michiel</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[variations]]></category>
		<category><![CDATA[webclient]]></category>

		<guid isPermaLink="false">http://www.sharepointblog.nl/?p=15</guid>
		<description><![CDATA[Last week I was trying to enable variations using a feature in SharePoint, but I soon realized that I had a problem because Microsoft decided to make all the variation-class internal. So that shouldn&#8217;t be a problem, why not use reflection. That didn&#8217;t work either, so back to the good old Lutz Roeder&#8217;s Reflector to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2007%2F10%2F14%2Fenable-variations-programmatically%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2007%2F10%2F14%2Fenable-variations-programmatically%2F&amp;source=m_lampje&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Last week I was trying to enable variations using a feature in SharePoint, but I soon realized that I had a problem because Microsoft decided to make all the variation-class internal. So that shouldn&#8217;t be a problem, why not use reflection. That didn&#8217;t work either, so back to the good old <a href="http://www.aisto.com/roeder/dotnet/" target="_blank">Lutz Roeder&#8217;s Reflector</a> to see what&#8217;s going on. I soon found out that variations are dependent on 2 hidden lists (VariationSettings, VariationLabels), both lists can be found using the AllProperties of the root web:<br />
<!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode"><span class="kwrd">using</span> (<span class="typ">SPSite</span> site = <span class="kwrd">new</span> <span class="typ">SPSite</span>(<span class="str">"http://localhost"</span>))
{
    <span class="kwrd">using</span> (<span class="typ">SPWeb</span> rootweb = site.RootWeb)
    {
        <span class="kwrd">string</span> _VarRelationshipsListId = rootweb.AllProperties[<span class="str">"_VarRelationshipsListId"</span>].ToString();
        <span class="kwrd">string</span> _VarLabelsListId = rootweb.AllProperties[<span class="str">"_VarLabelsListId"</span>].ToString();

        <span class="typ">SPList</span> VariationLabels = rootweb.Lists[<span class="kwrd">new</span> Guid(_VarLabelsListId)];
        <span class="typ">SPList</span> VariationSettings = rootweb.Lists[<span class="kwrd">new</span> Guid(_VarRelationshipsListId)];
    }
}</pre>
<p>The variationlabels list contains a listitem for each variation that is available on the site, just add a new listitem to the list (make sure there is only one listitem that has the field &#8220;Is Source&#8221; set to true):<br />
<!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">SPListItem variation = VariationLabels.Items.Add();
variation[<span class="str">"Hierarchy Is Created"</span>] = <span class="kwrd">false</span>;
variation[SPBuiltInFieldId.Title] = <span class="str">"EN"</span>;
variation[<span class="str">"Description"</span>] = <span class="str">"English"</span>;
variation[<span class="str">"Flag Control Display Name"</span>] = <span class="str">"English"</span>;
variation[<span class="str">"Language"</span>] = <span class="str">"en—US"</span>;
variation[<span class="str">"Locale"</span>] = 1033;
variation[<span class="str">"Hierarchy Creation Mode"</span>] = <span class="str">"Publishing Sites and All Pages"</span>;
variation[<span class="str">"Is Source"</span>] = <span class="kwrd">false</span>;
variation.Update();</pre>
<p>The variationsettings are a little bit different, the settings are saved to the propertybag of the rootfolder of the list:<br />
<!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">VariationSettings.RootFolder.Properties[<span class="str">"SourceVarRootWebTemplatePropertyName"</span>] = “sitetemplate#0”;
VariationSettings.RootFolder.Properties[<span class="str">"EnableAutoSpawnPropertyName"</span>] = <span class="kwrd">true</span>;
VariationSettings.RootFolder.Properties[<span class="str">"AutoSpawnStopAfterDeletePropertyName"</span>] = <span class="kwrd">true</span>;
VariationSettings.RootFolder.Properties[<span class="str">"UpdateWebPartsPropertyName"</span>] = <span class="kwrd">true</span>;
VariationSettings.RootFolder.Properties[<span class="str">"CopyResourcesPropertyName"</span>] = <span class="kwrd">true</span>;
VariationSettings.RootFolder.Properties[<span class="str">"SendNotificationEmailPropertyName"</span>] = <span class="kwrd">true</span>;
VariationSettings.Update();</pre>
<p>These settings where easy, but then came the hard part, how do I create the hierarchies since all logic is internally scoped. Then I had a brainwave, why not try the good old webclient&#8230; It works:<br />
<!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode"><span class="kwrd">using</span> (WebClient webClient = <span class="kwrd">new</span> WebClient())
{
    <span class="kwrd">byte</span>[] response;
    webClient.UseDefaultCredentials = <span class="kwrd">true</span>;
    response = webClient.DownloadData(input.Url + <span class="str">"/_Layouts/VariationLabels.aspx"</span>);

    <span class="rem">//get viewstate and requestdigest from page</span>
    <span class="kwrd">string</span> viewstate = ExtractHiddenValue(<span class="str">"__VIEWSTATE"</span>, Encoding.ASCII.GetString(response));
    <span class="kwrd">string</span> requestdigest = ExtractHiddenValue(<span class="str">"__REQUESTDIGEST"</span>, Encoding.ASCII.GetString(response));

    <span class="rem">//format the postdata</span>
    <span class="kwrd">string</span> postData =
        String.Format(<span class="str">"__VIEWSTATE={0}&amp;__REQUESTDIGEST={1}&amp;__EVENTTARGET={2}&amp;__EVENTARGUMENT={3}"</span>,
                      viewstate, requestdigest,
                      <span class="str">"ctl00$PlaceHolderMain$ctl00$RptControls$variationLabelsCreateHierarchiesToolBarButton"</span>,
                      <span class="str">""</span>);

    <span class="rem">//send postdata to server</span>
    webClient.Headers.Add(<span class="str">"Content-Type"</span>, <span class="str">"application/x-www-form-urlencoded"</span>);
    webClient.UploadData(input.Url + <span class="str">"/_Layouts/VariationLabels.aspx"</span>, <span class="str">"POST"</span>,
                         Encoding.ASCII.GetBytes(postData));
}</pre>
<p>Now I was finally able to create the hierachies in my build-script.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointblog.nl/2007/10/14/enable-variations-programmatically/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>First publication in .NET Magazine #18</title>
		<link>http://www.sharepointblog.nl/2007/10/09/first-publication-in-net-magazine-18/</link>
		<comments>http://www.sharepointblog.nl/2007/10/09/first-publication-in-net-magazine-18/#comments</comments>
		<pubDate>Tue, 09 Oct 2007 15:16:19 +0000</pubDate>
		<dc:creator>Michiel</dc:creator>
				<category><![CDATA[MOSS]]></category>
		<category><![CDATA[WSS]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.sharepointblog.nl/?p=9</guid>
		<description><![CDATA[I finally did it&#8230; I wrote my first article (dutch) together with my colleague Willem Boeré for Microsoft .NET Magazine. The article is about building SharePoint Solution with features and custom site-templates. And finally I will start blogging about SharePoint, I have been doing MOSS 2007 projects for more than a year now (started with [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2007%2F10%2F09%2Ffirst-publication-in-net-magazine-18%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2007%2F10%2F09%2Ffirst-publication-in-net-magazine-18%2F&amp;source=m_lampje&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I finally did it&#8230;</p>
<p>I wrote my first <a href="http://download.microsoft.com/download/8/7/e/87effb07-b40a-43b5-b84e-013642b61860/DNM18_47-52_1%2006.pdf" target="_blank">article</a> (dutch) together with my colleague <a href="http://cid-4d50f6e95d2a70c9.spaces.live.com/?owner=1" target="_blank">Willem Boeré</a> for Microsoft .NET Magazine. The article is about building SharePoint Solution with features and custom site-templates.<br />
And finally I will start blogging about SharePoint, I have been doing MOSS 2007 projects for more than a year now (started with beta 1), so I will have quite a lot of stuff to blog about.</p>
<p>Hope to see you back again&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointblog.nl/2007/10/09/first-publication-in-net-magazine-18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
