Category Archives: SharePoint

Correcting issue: multiple defaultviews for a SharePoint list

Should you encounter this issue (for example after you imported a list into an existing list), you will find that you are not able to set the DefaultView property of the view to false or rather it will have no effect. The defaultview property remains true for the view you just updated.

Instead you should update the view you want to keep as default view. By setting the defaultview to true and updating both the view and the list.

SharePoint will correct the other views accordingly (and you won’t see your list multiple times in the site contents anymore).

Advertisements

CountDictionary is undefined

When migrating custom solutions from an earlier version of SharePoint to SharePoint 2016 you might run into this javascript error.

Most likely when you try to count how many items are selected in a listview.

The code of the origional function (which probably still exists, but is now scoped to that SharePoint functionality within the javascript file (inplview.js)) looked like this:

function CountDictionary(b) {
var a = 0, c;
for (c in b)
a++;
return a
}

We see in 2016 that this is used to retrieve the number of currently selected items:

ListModule.Util.countSelectedItems(this.ctx)

So you could use that instead.

Add a multilingual field to SharePoint through code

I will explain how to add a multilingual field with codebehind because this is quite tricky…

Let’s say you want to add a field ‘Client’ when a certain feature is activated. A reason for this to be in codebehind could be that this feature already existed and you’re writing an update. So you want the field to be added to exisitng lists aswell. And ofcourse for Dutch users it should read ‘Klant’.

So here is the code to show you how to add a multilingual field (sorry, for the layout wordpress is not so code friendly (or do enlighten me ūüėČ )):
Continue reading

System.ArgumentNullException: Key cannot be null.

So you are happily adding custom Fields, and/or FieldRefs to your ContentType, through Visual Studio for SharePoint and you deploy the outcome to your farm and when you want to activate your feature the following error pops up:

[ArgumentNullException: Key cannot be null.
Parameter name: key]
Continue reading

How to: Deploying an Infopath form as a feature

What do we want to achieve?

It is quite easy to customize a list and create a nice form in InfoPath through InfoPath Designer, but what are the required steps to make this into a solution package so it’s available with just¬†a few simple clicks on any site in your SharePoint farm¬†(namely by¬†activating¬†a few¬†features)? And ofcourse it should open in the browser and populate the fields!

Continue reading

Cannot remove Sharepoint Project item from feature error

Should you ever get this error “Cannot remove Sharepoint Project item from feature” due to a null reference exception in Visual Studio 2012. Close the feature designer and re-open it.

SharePoint 2010, Powershell and BindingRedirects

Powershell is a great tool when working with SharePoint 2010!

However there is one thing to be wary of: BindingRedirects.

Continue reading

SharePoint 2010 Solutions – Resources

I wrote this guide about how to use resource files in SharePoint 2010 solutions for my company and often reread it, so I thought to translate it to English and share it with you.

Continue reading