<?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>Frederik Prijck&#039;s Blog</title>
	<atom:link href="http://blog.voltje.be/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.voltje.be</link>
	<description>.Net programming for ECM systems</description>
	<lastBuildDate>Thu, 03 May 2012 20:08:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Programmaticly creating custom actions</title>
		<link>http://blog.voltje.be/?p=307&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=programmaticly-creating-custom-actions</link>
		<comments>http://blog.voltje.be/?p=307#comments</comments>
		<pubDate>Tue, 13 Mar 2012 09:34:19 +0000</pubDate>
		<dc:creator>Frederik Prijck</dc:creator>
				<category><![CDATA[SharePoint 2010 Development]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[custom action]]></category>
		<category><![CDATA[list action]]></category>
		<category><![CDATA[programmaticly]]></category>

		<guid isPermaLink="false">http://blog.voltje.be/?p=307</guid>
		<description><![CDATA[This is a quick blog post to show you how to add a custom action using c#.NET. In some cases you programmaticly create a SPList which will require a custom action. If this custom action is required for only this SPList, I would advice creating this custom action using the following example: Using this example [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick blog post to show you how to add a custom action using c#.NET.<br />
In some cases you programmaticly create a SPList which will require a custom action. If this custom action is required for only this SPList, I would advice creating this custom action using the following example:</p>
<pre class="brush: csharp; title: ; notranslate">
SPUserCustomAction action = oList.UserCustomActions.Add();
action.Title = &quot;MyActionTitle&quot;;
action.Description = &quot;MyActionDescription&quot;;
action.Location = &quot;Microsoft.SharePoint.ListEdit&quot;;
action.Group = &quot;Permissions&quot;;
action.Url = &quot;~site/_layouts/yourpage.aspx?List=&quot; + oList.ID.ToString();
action.Update();
</pre>
<p>Using this example you should be able to create your own custom actions using C#.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voltje.be/?feed=rss2&#038;p=307</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint 2010 and the Lookup Column issue</title>
		<link>http://blog.voltje.be/?p=289&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sharepoint-2010-and-the-lookup-column-issue</link>
		<comments>http://blog.voltje.be/?p=289#comments</comments>
		<pubDate>Tue, 14 Feb 2012 13:25:54 +0000</pubDate>
		<dc:creator>Frederik Prijck</dc:creator>
				<category><![CDATA[SharePoint 2010 Bugs]]></category>

		<guid isPermaLink="false">http://blog.voltje.be/?p=289</guid>
		<description><![CDATA[SharePoint has a great column type: Lookup. This column type will, as the name says, look up values in another list. It is used to link two lists to eachother (1-1 or 1-n relation). The lookup column type is displayed as a standard dropdown list. But watch out, when the source list (the list from [...]]]></description>
			<content:encoded><![CDATA[<p>SharePoint has a great column type: <strong>Lookup</strong>.<br />
This column type will, as the name says, look up values in another list. It is used to link two lists to eachother (1-1 or 1-n relation).</p>
<p>The lookup column type is displayed as a standard dropdown list. But watch out, when the source list (the list from which the Lookup column reads its values) contains more than 20 items some things just don&#8217;t work as expected or don&#8217;t work at all.</p>
<p>When there are less then 20 lookup items, the column is displayed as a <strong>select </strong>control. No problem in this situation.<br />
When the amount of lookup items is bigger then 20, the <strong>select</strong> controls is <strong>replaced </strong>by an <strong>input </strong>(text) field, an <strong>image </strong>(the dropdown arrow) and a <strong>select</strong> control (this select control is not visible at page load).</p>
<p>The reason they do this is because the user can type in the input field with auto complete (javascript).  Since the user has to many values to select from a dropdown, this is a very powerful option in SharePoint (or at least it can be powerful if it worked properly).</p>
<p>When clicking on the image, the <strong>select </strong>control will pop up containing the lookup values you can choose from.. Clicking any value inside this <strong>select</strong> control will make this control disappear again. The input control will now contain the display value of the lookup value (the one the used clicked on).</p>
<h2>Cascading Style Sheet</h2>
<p>The first problem on this way of rendering the Lookup column (on + 20 items) is that the css will not work anymore.<br />
After looking into the html I found that SharePoint positiones the <strong>select </strong>control (when clicking the image) using core.js.</p>
<p>The function in core.js is called <strong>FilterChoice(opt, ctrl, strVal, filterVal)</strong> this function will do more than positioning the <strong>select </strong>control. (this function also positions the lookup column with less then 20 items, although here is no css problem). Since the <strong>top </strong>and <strong>left </strong>css property is set everytime when a user <strong>clicks </strong>the <strong>image</strong>, we are not able to fix this problem using css. To fix this we should override the FilterChoice function.</p>
<p><em><strong>[SOLUTION TO BE INSERTED]</strong></em></p>
<h2>Content Organizer</h2>
<p>Apart from the css problem this alternative way of rendering the lookup column works fine. Atleast at first sight…<br />
When you are creating Content Organizer rules based on a Lookup column (with +20 values) an even worse problem shows up.</p>
<h3>Scenario&#8217;s</h3>
<p>Creating a content organizer rule based on a lookup column with less then 20 items will work as expected. The rule is created and documents dropped in the drop off library containing this metadata will be routed to the destination list.</p>
<p>When you are creating a content organizer rule based on a lookup column with more then 20 items, the control will be rendered as mentioed above (input, image, select controls). Saving the rule will work normally but you will find out that the rule is not working. Files will not be routed when containing the metadata you&#8217;ve selected in the rule.</p>
<p>Editing the content organizer rule will tell you why… On the edit page, the value of the lookup column will be set to (none).<br />
I&#8217;ve done hours of reflectoring and debugging (at run time) the microsoft assemblies and found that the following method is causing this behavior:</p>
<pre class="brush: csharp; title: ; notranslate">
private BaseFieldControl GetBaseFieldControlForCondition(int clauseNum, int fcIndexWithinClause)
{
    return (this.conditionControls.Controls[0].Controls[(clauseNum * this.availableColumns.Items.Count) + fcIndexWithinClause].Controls[3] as BaseFieldControl);
}
</pre>
<p>In the scenario when there are less then 20 lookup values, this BaseFieldControl will contain a value equal to the index of the value inside the dropdown list. When there are more than 20 items, the control will be rendered as mentioned above (input, image, select controls) and the value of the BaseFieldControl will be equal to 0. SharePoint will think this is the index of the selected value, therefor (none) will be saved (since this is the first option).</p>
<p>My guess is that Microsoft developers forget to make this function work with the special way of rendering the lookup column.</p>
<h3>What is going wrong ?</h3>
<p>Looking at the <strong>GetBaseFieldControlForCondition </strong>method, it is pointing to child controls of the &#8220;conditionControls&#8221; element. Inspecting the html of the masterpage (not in the browser, but on your filesystem) show us how this control looks like:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;table id=&quot;conditionControlTable&quot;&gt;&lt;tr&gt;&lt;td id=&quot;conditionControls&quot; runat=&quot;server&quot;/&gt;&lt;/tr&gt;&lt;/table&gt;
</pre>
<p>Initialy, this control contains no childs. At runtime, this control looks like (this html is based on my content type):</p>
<p>http://www.pastie.org/3303266</p>
<p>As you can see the control contains alot of children and the ID is replaced with<br />
<strong>ctl00_PlaceHolderMain_conditionSection_addClauseLabel_conditionControls </strong>which is normal and has nothing to do with our problem.</p>
<p>The problem is that the <strong>GetBaseFieldControlForCondition </strong>will try to call the control containing the index of the selected lookup item which is stored in the value attribute. After doing some run-time debugging using reflector pro (which is an awsome tool btw!) I found out that, working with the special way of rendering a lookup column, will return a value of 0.<br />
There&#8217;s no &#8220;object not set to an instance of an object&#8221; exception, so the control is found, but doesn&#8217;t contain the correct value.</p>
<p>Until now, I haven&#8217;t find any solution yet.  Although my guess is it can be solved using a few Jquery lines to set the value attribute to the correct lookup index. Unfortunalty, I haven&#8217;t found which control needs to be set <img src='http://blog.voltje.be/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voltje.be/?feed=rss2&#038;p=289</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Deploying Content Types and Fields</title>
		<link>http://blog.voltje.be/?p=282&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=deploying-content-types-and-fields</link>
		<comments>http://blog.voltje.be/?p=282#comments</comments>
		<pubDate>Tue, 14 Feb 2012 13:17:44 +0000</pubDate>
		<dc:creator>Frederik Prijck</dc:creator>
				<category><![CDATA[SharePoint 2010 Development]]></category>
		<category><![CDATA[best practise]]></category>
		<category><![CDATA[Content Types]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Fields]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.voltje.be/?p=282</guid>
		<description><![CDATA[When using content types it&#8217;s best practice (at least for me it is) to maintain the following development rules XML versus Code Content Types can be created both declarative (xml) and using code. Before first deployment, all CT changes can be made to the XML file. Once one deployment (not on ur own VM) has [...]]]></description>
			<content:encoded><![CDATA[<p>When using content types it&#8217;s best practice (at least for me it is) to maintain the following development rules</p>
<p><strong>XML versus Code</strong><br />
Content Types can be created both declarative (xml) and using code.<br />
Before first deployment, all CT changes can be made to the XML file.<br />
Once one deployment (not on ur own VM) has taken place, no changes should be made to<br />
this XML file. Instead adapt the CT&#8217;s using CT.</p>
<p><strong>Why?</strong><br />
After experimenting with both ways of provisioning (xml and code) I came to the constatation that<br />
Changes made to the XML after deployment will not be pushed through to Lists using this CT.<br />
When the same changes are made using code, everything is pushed through as expected (when calling SPContentType.Update(true) of course).</p>
<p><strong>Scenarios</strong></p>
<p><em><strong>I would like to create &#8220;Field A&#8221; and &#8220;Field B&#8221; which will be added to a newly created CT named &#8220;Content Type 1&#8243;.</strong></em><br />
All of this can be done using the Elements.XML file, since no deployment has been occured yet.</p>
<p><em><strong>I would like to change a property of &#8220;Field A&#8221; (Display name, required, …) which will affect all lists using this Field.</strong></em><br />
DO NOT modify the Element.xml, modifications made to this file will not affect existing lists. They will only affect the Site Content Types. Instead make the modifications using code, be sure to call SPContentType.Update(true).</p>
<p><em><strong>I would like to add a new Field &#8220;Field C&#8221; (this field is not yet provisioned) and add it to &#8220;Content Type 1&#8243;</strong></em><br />
Edit the Elements.xml file to add the new Field &#8220;Field C&#8221; (do not connect it to the content type ! ).<br />
Connecting this Field the the desired (and existing) Content Types is done through code.</p>
<p><em><strong>I would like to add a Field to a new Content Type (it doesn&#8217;t matter if this Field is new or if it is already available)</strong></em><br />
All changes can be done using the XML. Since you do not modify any XML which has already been provisioned.<br />
A new tag will be added to the XML with the desired tags. This will not conflict since the CT is new.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voltje.be/?feed=rss2&#038;p=282</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Copy Document ID url(s) to clipboard</title>
		<link>http://blog.voltje.be/?p=277&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=copy-document-id-urls-to-clipboard</link>
		<comments>http://blog.voltje.be/?p=277#comments</comments>
		<pubDate>Mon, 05 Dec 2011 08:34:06 +0000</pubDate>
		<dc:creator>Frederik Prijck</dc:creator>
				<category><![CDATA[Sharepoint 2010]]></category>
		<category><![CDATA[document id]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://blog.voltje.be/?p=277</guid>
		<description><![CDATA[Many clients complained that MOSS document management suffered from two features which were inexcusable: Lack of unique identifiers for documents: This is really important in any Document Management System, in particular in Records Management URL’s to documents containing location information: If you have a look at MOSS/WSS document URL’s they contained a location, move a [...]]]></description>
			<content:encoded><![CDATA[<p>Many clients complained that MOSS document management suffered from two features which were inexcusable:</p>
<ul>
<li>Lack of unique identifiers for documents: This is really important in any Document Management System, in particular in Records Management</li>
<li>URL’s to documents containing location information: If you have a look at MOSS/WSS document URL’s they contained a location, move a document to any different location and you lose the link! This is a major shortcoming in an ECM system as we are now forced to look for documents based on location, rather than on metadata.</li>
</ul>
<p>With the release of Document ID&#8217;s Microsoft removed the two issues mentioned above.</p>
<p>I decided to share a few of my JavaScript snippets which may be useful when working with Unique Document ID&#8217;s in SharePoint.</p>
<p><strong>Copy Persistet url to clipboard for one document</strong></p>
<pre class="brush: jscript; title: ; notranslate">
var DocIdPrefix  = &quot;&quot;;
function CopyPersistedUrlToClipboard(listItemId, listId) {
    getPersistetUrlPrefix();
    var ctx = new SP.ClientContext.get_current();
    this.web = ctx.get_web();
    ctx.load(this.web);

    this.currentLib = web.get_lists().getById(listId);
    ctx.load(currentLib);
    this.listItem = currentLib.getItemById(listItemId);
    ctx.load(this.listItem);

    ctx.executeQueryAsync(Function.createDelegate(this, this.CopyPersistedUrlToClipboardOnSuccess),
            Function.createDelegate(this, this.CopyPersistedUrlToClipboardOnFail));
}

function CopyPersistedUrlToClipboardOnSuccess(sender, args) {
    var url = DocIdPrefix + this.listItem.get_item('_dlc_DocId');
    clipboardData.setData('Text', url);
    ShowStatusBar('Copy persistent Urls', 'Url copied to clipboard');

}
function CopyPersistedUrlToClipboardOnFail(sender, args) {
    ShowStatusBar('Copy persistent Url', 'Failed to copy persistent Url to clipboard');
}
</pre>
<p>You will find out that I did not include the function  &#8220;getPersistetUrlPrefix()&#8221;, this is a function which returns the prefix used in the persisted url.<br />
The body of this method will depend on your environment, my method will return &#8220;<strong>http://[URLTOMYCENTRALSITECOLLECTION]/_layouts/DocIdRedir.aspx?ID=</strong>&#8220;, which will be used as url prefix for all my persisted urls in the farm.</p>
<p>You can decide to use one url prefix which will be used in every sitecollection and webapplication, or use a seperate prefix for each web application.<br />
I decided to go for the previous example which will generate some problems later on which needs to be solved.<br />
If you are new to SharePoint development or if it does not matter in your environment I would advice you to use the second way (seperated prefix per webapplication).</p>
<p>To make this javascript available inside SharePoint use a custom action as described below</p>
<pre class="brush: xml; title: ; notranslate">
&lt;CustomAction
                               Id=&quot;{843AEE73-B596-42b8-83FD-104C771E658B}&quot;
                               RegistrationType=&quot;ContentType&quot;
                               ShowInLists = &quot;True&quot;
                               RegistrationId=&quot;0x0101&quot;
                               Location=&quot;EditControlBlock&quot;
                               Sequence=&quot;101&quot;
                               Title=&quot;Copy Persistent URL to clipboard&quot;&gt;

    &lt;UrlAction Url=&quot;javascript:CopyPersistedUrlToClipboard('{ItemId}','{ListId}');&quot;/&gt;
  &lt;/CustomAction&gt;
</pre>
<p><strong>Copy Persistet url to clipboard for multiple documents</strong><br />
The above explanation will only work for one document, tho it might be usefull to copy multiple persisted urls to clipboard.<br />
The javascript code to achieve this is almost the same</p>
<pre class="brush: jscript; title: ; notranslate">
function CopySelectedPersistedUrlsToClipboard(listId) {
    getPersistetUrlPrefix();
    this.itemsArray = new Array();
    var ctx = new SP.ClientContext.get_current();
    this.web = ctx.get_web();
    ctx.load(this.web);
    this.currentLib = web.get_lists().getById(listId);
    ctx.load(currentLib);

    var selectedItems = SP.ListOperation.Selection.getSelectedItems(ctx);
    var item;
    for (item in selectedItems) {
        var Listitem = currentLib.getItemById(selectedItems[item].id);
        this.itemsArray[this.itemsArray.length] = Listitem;
        ctx.load(Listitem);
    }

    ctx.executeQueryAsync(Function.createDelegate(this, this.CopySelectedPersistedUrlsToClipboardOnSuccess),
            Function.createDelegate(this, this.CopySelectedPersistedUrlsToClipboardOnFail));
}
function CopySelectedPersistedUrlsToClipboardOnSuccess(sender, args) {
    var toCopy = '';
    for (i = 0; i &lt; this.itemsArray.length; i++) {
        var item = this.itemsArray[i];
        toCopy += DocIdPrefix + item.get_item('_dlc_DocId') + '\n';
    }

    clipboardData.setData('Text', toCopy);
    ShowStatusBar('Copy selected persistent Urls', this.itemsArray.length + ' Url(s) copied to clipboard');

}
function CopySelectedPersistedUrlsToClipboardOnFail(sender, args) {
    ShowStatusBar('Copy selected persistent Urls', 'Failed to copy multiple persistent Urls to clipboard (Error: ' + args.get_message() + ')');
}
</pre>
<p>To enable this in a SharePoint library I have created a Ribbon Button which will execute this javascript method.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;CustomAction
    Id=&quot;CustomRibbonButton_CopyUrls&quot;
    RegistrationId=&quot;0x0101&quot;
    RegistrationType=&quot;ContentType&quot;
    Location=&quot;CommandUI.Ribbon&quot;
    Sequence=&quot;1005&quot;
    Title=&quot;Alert!&quot;&gt;
    &lt;CommandUIExtension&gt;
      &lt;CommandUIDefinitions&gt;
        &lt;CommandUIDefinition Location=&quot;Ribbon.Documents.Share.Controls._children&quot;&gt;
          &lt;Button
              Id=&quot;Ribbon.Documents.New.CopyPersistentUrls&quot;
              Alt=&quot;Copy Url(s)!&quot;
              Sequence=&quot;149&quot;
              Command=&quot;CustomRibbonButton_CopyUrls_Command&quot;
              Image32by32=&quot;/_layouts/IMAGES/bigImage.gif&quot;
              Image16by16=&quot;/_layouts/IMAGES/smallImage.gif&quot;
              LabelText=&quot;Copy Url(s)&quot;
              TemplateAlias=&quot;o1&quot; /&gt;
        &lt;/CommandUIDefinition&gt;
      &lt;/CommandUIDefinitions&gt;

      &lt;CommandUIHandlers&gt;
        &lt;CommandUIHandler
          Command=&quot;CustomRibbonButton_CopyUrls_Command&quot;
          CommandAction=&quot;javascript:CopySelectedPersistedUrlsToClipboard('{ListId}');&quot; /&gt;
      &lt;/CommandUIHandlers&gt;

    &lt;/CommandUIExtension&gt;
  &lt;/CustomAction&gt;
</pre>
<p>I hope these snippets may be useful for you, If you got any questions feel free to post them !</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voltje.be/?feed=rss2&#038;p=277</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using RunWithElevatedPrivileges for file system operations</title>
		<link>http://blog.voltje.be/?p=275&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-runwithelevatedprivileges-for-file-system-operations</link>
		<comments>http://blog.voltje.be/?p=275#comments</comments>
		<pubDate>Wed, 16 Nov 2011 22:21:08 +0000</pubDate>
		<dc:creator>Frederik Prijck</dc:creator>
				<category><![CDATA[Sharepoint 2010]]></category>
		<category><![CDATA[ElevatedPriviliges]]></category>
		<category><![CDATA[IO]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://blog.voltje.be/?p=275</guid>
		<description><![CDATA[Everyone knows how SPSecurity.RunWithElevatedPrivileges can be used to run some SharePoint code as the application pool account. Recently, I came to a point where I wanted to know whether this can also be used to run file system operations (such as System.IO.File.Create()) as the application pool account. When security is a sensitive subject inside your [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone knows how SPSecurity.RunWithElevatedPrivileges can be used to run some SharePoint code as the application pool account.<br />
Recently, I came to a point where I wanted to know whether this can also be used to run file system operations (such as System.IO.File.Create()) as the application pool account.</p>
<p>When security is a sensitive subject inside your environment, you may not want to give every use access on a specific folder or fileshare.</p>
<p>When working with SharePoint it can be useful to only give the application pool account permissions to access this location.<br />
This way we can run code inside the SPContext as this account using SPSecurity.RunWithElevatedPriviliges.</p>
<pre class="brush: csharp; title: ; notranslate">
SPSecurity.RunWithElevatedPriviliges(delegate(){
System.IO.File.Create(@&quot;c:\ProtectedFolder\FileName.txt&quot;);
});
</pre>
<p>In this example a file &#8220;FileName.txt&#8221; will be created in the &#8220;c:\ProtectedFolder&#8221; folder. Only the application pool account can access this location.<br />
Without wrapping the code with SPSecurity.RunWithElevatedPriviliges, this code will throw an exception if this is executed as a non application pool account.</p>
<p>Cool to know SPSecurity.RunWithElevatedPriviliges also works on these operations! <img src='http://blog.voltje.be/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voltje.be/?feed=rss2&#038;p=275</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Work in progress</title>
		<link>http://blog.voltje.be/?p=272&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=work-in-progress</link>
		<comments>http://blog.voltje.be/?p=272#comments</comments>
		<pubDate>Thu, 03 Nov 2011 15:29:03 +0000</pubDate>
		<dc:creator>Frederik Prijck</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://blog.voltje.be/?p=272</guid>
		<description><![CDATA[As you may have noticed, the design of my blog is currently in progress. I am re-organising everything. In the meanwhile I will keep on blogging. Thanks for the patience.]]></description>
			<content:encoded><![CDATA[<p>As you may have noticed, the design of my blog is currently in progress.<br />
I am re-organising everything. In the meanwhile I will keep on blogging.<br />
Thanks for the patience.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voltje.be/?feed=rss2&#038;p=272</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell script to activate features on sitecollection based on an XML configuration file</title>
		<link>http://blog.voltje.be/?p=256&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=powershell-script-to-activate-features-on-sitecollection-based-on-an-xml-configuration-file</link>
		<comments>http://blog.voltje.be/?p=256#comments</comments>
		<pubDate>Wed, 19 Oct 2011 07:13:32 +0000</pubDate>
		<dc:creator>Frederik Prijck</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[activate features]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.voltje.be/?p=256</guid>
		<description><![CDATA[I&#8217;ve been working on a PowerShell script to activate features in a site collection based on an XML configuration file. Basicly, this script doesn&#8217;t do anything special but I realy enjoyed my first powershell scripting experience. Since this script is pretty reusable, I decided to share it with others. The XML configuration file has to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a PowerShell script to activate features in a site collection based on an XML configuration file.<br />
Basicly, this script doesn&#8217;t do anything special but I realy enjoyed my first powershell scripting experience.<br />
Since this script is pretty reusable, I decided to share it with others.</p>
<p>The XML configuration file has to have the following structure</p>
<pre class="brush: xml; title: ; notranslate">
&lt;ActivateFeatures&gt;
    &lt;Site Url=&quot;http://demo&quot; ItterateWebApp=&quot;False&quot; /&gt;
    &lt;Features&gt;
       &lt;Feature ReactivateIfActive=&quot;False&quot; Id=&quot;498074b3-5f0e-46c9-8656-58bc5f4eabff&quot;/&gt;
&lt;/Features&gt;
&lt;/ActivateFeatures&gt;
</pre>
<p>The <strong>Site</strong> tag includes the site collection on which we want to activate the features. (Note: When ItterateWebApp has been set to True, the features will be activated on <strong>every</strong> site collection inside the web application of the specified site collection.</p>
<p>Each <strong>Feature</strong> tag should include the ReactivateIfActive and Id attributes.<br />
<strong>ReactivateIfActive </strong>tells the powershell script whether or not to reactivate a feature incase it has already been activated whereas <strong>Id </strong>represents the GUID of the feature.</p>
<p>Put this .xml configuration file in the same directory as the powershell script.<br />
To execute the script based on the XML file please use the following command in a .BAT file</p>
<pre class="brush: csharp; title: ; notranslate">
powershell.exe -noexit -command .\ActivateFeature.ps1
</pre>
<p>The powershell script will start automaticly.<br />
If you want to use this script without the XML configuration file, the following cmdlet can be used</p>
<pre class="brush: csharp; title: ; notranslate">
Activate-SPFeature -SiteURL &quot;http://demo&quot; -FeatureGUID &quot;498074b3-5f0e-46c9-8656-58bc5f4eabff&quot; -ItterateWebApp $false -ReactivateIfActive $false
</pre>
<p>The source files, including the PS script, XML file and bat fire can be downloaded <a href='http://blog.voltje.be/wp-content/uploads/2011/10/ActivateFeatures.zip'>here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voltje.be/?feed=rss2&#038;p=256</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Default column values vs Document Information Panel</title>
		<link>http://blog.voltje.be/?p=218&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=default-column-values-vs-document-information-panel</link>
		<comments>http://blog.voltje.be/?p=218#comments</comments>
		<pubDate>Tue, 04 Oct 2011 12:04:40 +0000</pubDate>
		<dc:creator>Frederik Prijck</dc:creator>
				<category><![CDATA[Sharepoint 2010]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[Managed Metadata]]></category>
		<category><![CDATA[Office]]></category>

		<guid isPermaLink="false">http://blog.voltje.be/?p=218</guid>
		<description><![CDATA[When working with default column values you might run into the same problem as I did. When you click the ‘New’ button on a document library, which has a content type attached using an office template, a new office document opens up as expected. It might be possible that the default values are not shown [...]]]></description>
			<content:encoded><![CDATA[<p>When working with default column values you might run into the same problem as I did.<br />
When you click the ‘New’ button on a document library, which has a content type attached using an office template, a new office document opens up as expected.<br />
It might be possible that the default values are not shown correctly inside the document information panel, but why is this happening and especially why is this not always happening?<br />
Consider the following situation:</p>
<ul>
<li>Create a new document library and attach a content type which uses a Word template
<ul>
<li>The content type has some columns with a default value</li>
</ul>
</li>
<li>Click the ‘New’ button and word pops up</li>
<li>You will see that the default values in the DIP are set correctly.</li>
<li>Close word</li>
<li>Go to site settings and change one of the column’s default value.</li>
<li>Click the ‘new’ button (on the same as before library)  again</li>
<li>You will see that the default values in de DIP are incorrect.</li>
</ul>
<p>It looks like the DIP uses  some kind of caching mechanism. The DIP is built based on the content type’s schema.<br />
Whenever this schema changes, the DIP will not pick up this changes.<br />
Note: When talking about DIP I mean the standard DIP, and not a custom document information panel.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voltje.be/?feed=rss2&#038;p=218</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Add &#8220;New Document&#8221; link you your custom application page</title>
		<link>http://blog.voltje.be/?p=211&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=add-new-document-link-you-your-custom-application-page</link>
		<comments>http://blog.voltje.be/?p=211#comments</comments>
		<pubDate>Fri, 02 Sep 2011 14:46:51 +0000</pubDate>
		<dc:creator>Frederik Prijck</dc:creator>
				<category><![CDATA[Sharepoint 2010]]></category>
		<category><![CDATA[application page]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[office 2003]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://blog.voltje.be/?p=211</guid>
		<description><![CDATA[When working with SharePoint document libraries there are two ways to add new files: update file and add new. The &#8220;Add new document&#8221; link will startup the corresponding client application (word, excel, ..) to create a new file based on the template which is set inside the content type. Maybe some of you have come [...]]]></description>
			<content:encoded><![CDATA[<p>When working with SharePoint document libraries there are two ways to add new files: update file and add new.<br />
The &#8220;Add new document&#8221; link will startup the corresponding client application (word, excel, ..) to create a new file based on the template which is set inside the content type.</p>
<p>Maybe some of you have come to a point where you would like to create a &#8220;New Document&#8221; link somewhere insite your page.<br />
This can be done by calling some javascript functions.</p>
<p><strong>Open infopath in client application</strong></p>
<pre class="brush: jscript; title: ; notranslate">
CoreInvoke('createNewDocumentWithRedirect','http://[siteurl]/FormServerTemplates/[templatename].xsn', '[FullUrlToLibrary]', 'SharePoint.OpenXmlDocuments.2', true, 'http://[siteurl]/_layouts/FormServer.aspx?XsnLocation=http://[siteurl]/FormServerTemplates/[templatename].xsn', false, 0);
</pre>
<p><strong>Open infopath in browser (setting must be activated on the library)</strong></p>
<pre class="brush: jscript; title: ; notranslate">
CoreInvoke('createNewDocumentWithRedirect','http://[siteurl]/FormServerTemplates/[templatename].xsn', '[FullUrlToLibrary]', 'SharePoint.OpenXmlDocuments.2', true, 'http://[siteurl]/_layouts/FormServer.aspx?XsnLocation=http://[siteurl]/FormServerTemplates/[templatename].xsn', false, 1);
</pre>
<p><strong>Open document in word</strong></p>
<pre class="brush: jscript; title: ; notranslate">
CoreInvoke('createNewDocumentWithProgID', '[FullUrlToWordTemplate]', '[FullUrlToLibrary]', 'SharePoint.OpenDocuments', false);
</pre>
<p><strong>Open document in excel</strong></p>
<pre class="brush: jscript; title: ; notranslate">
CoreInvoke('createNewDocumentWithProgID', '[FullUrlToExcelTemplate]', '[FullUrlToLibrary]', 'SharePoint.OpenDocuments', false);
</pre>
<p>this function also works for opening excel:</p>
<pre class="brush: jscript; title: ; notranslate">
CoreInvoke('createNewDocumentWithRedirect','[FullUrlToExcelTemplate]', '[FullUrlToLibrary]', 'SharePoint.OpenDocuments', false, '[siteurl]/_layouts/xlviewer.aspx?new=1', true, 0 );
</pre>
<p><strong>Open document in powerpoint</strong></p>
<pre class="brush: jscript; title: ; notranslate">
CoreInvoke('createNewDocumentWithProgID', '[FullUrlToPowerpointTemplate]', '[FullUrlToLibrary]', 'SharePoint.OpenDocuments', false);
</pre>
<p>When you would like to use these code inside your custom application pages make sure to override its &#8220;OnPreRender&#8221; method</p>
<pre class="brush: csharp; title: ; notranslate">
protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            ScriptLink.RegisterScriptAfterUI(this.Page, &quot;core.js&quot;, true, false);
            ScriptLink.RegisterScriptAfterUI(this.Page, &quot;CUI.js&quot;, false, true);
            ScriptLink.RegisterScriptAfterUI(this.Page, &quot;SP.js&quot;, false, true);
        }
</pre>
<p>The reason for which we need to override the OnPreRender method is because we have to make sure the standard SharePoint .js files are loaded before our page is rendered.</p>
<p>Good luck !</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voltje.be/?feed=rss2&#038;p=211</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Fixing the flyout delay in the Sharepoint dynamic navigation</title>
		<link>http://blog.voltje.be/?p=208&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fixing-the-flyout-delay-in-the-sharepoint-dynamic-navigation</link>
		<comments>http://blog.voltje.be/?p=208#comments</comments>
		<pubDate>Tue, 26 Jul 2011 13:39:35 +0000</pubDate>
		<dc:creator>Frederik Prijck</dc:creator>
				<category><![CDATA[Sharepoint 2010]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Delay]]></category>
		<category><![CDATA[Dynamic]]></category>
		<category><![CDATA[Flyout]]></category>
		<category><![CDATA[Menu]]></category>

		<guid isPermaLink="false">http://blog.voltje.be/?p=208</guid>
		<description><![CDATA[When working with SharePoint you may have find out that SharePoint keeps navigation items (from the global navigation menu) open for a few seconds after moving the mouse. This can result in a lot of open items when moving your mouse quickly over multiple items. To fix this simple put the following lines in your [...]]]></description>
			<content:encoded><![CDATA[<p>When working with SharePoint you may have find out that SharePoint keeps navigation items (from the global navigation menu) open for a few seconds after moving the mouse.<br />
This can result in a lot of open items when moving your mouse quickly over multiple items.</p>
<p>To fix this simple put the following lines in your stylesheet:</p>
<pre class="brush: xml; title: ; notranslate">
li.hover-off&gt;ul
{
    display:none;
}
</pre>
<p>Short explanation: When you hover over a menu item, SharePoint adds a class called &#8220;hover&#8221;. Once you move your mouse away, the class is changed to &#8220;hover-off&#8221; before removing it completely.<br />
Adding the above css will make the menuitem disappear immediately when your mouse leaves the area.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voltje.be/?feed=rss2&#038;p=208</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

