SharePoint Dragons

Nikander & Margriet on SharePoint

Monthly Archives: May 2012

Missing SharePoint 2010 Project Templates

What to do when you can’t find the SharePoint 2010 project templates in Visual Studio.NET 2010? This link discusses what you can do.

The SharePoint Flavored Weblog Reader v1.1

In a previous post, we’ve talked about a tool we’ve created, the SharePoint Flavored WebLog Reader: It’s a free tool that analyzes the IIS logs of SharePoint farms and generates several textual reports about them. We’ve just released an update to it (v1.1) and based on community feedback, two new features were incorporated:

  • An overview was added that displays the number of searches executed per user.
  • An overview was added of the top slowest requests for a specific user.

You can get it here:

Web.config modifications

This is a nice blog post that explains how to make web.config modificatons via a SharePoint feature:

Estimating and Benchmarking SharePoint projects

Potentially, this is the most interesting and exciting Wiki page we’ve ever worked on: On the other hand, it may well turn out to be a waste of our time. We’ll let you decide, we’ve taken the first steps. We very much want to encourage you to read it, appreciate it, contribute to it, or ignore it (hah, just when you thought you didn’t fit in any of the groups we went in for the kill!). Depending on what happens, it can become something quite special or we’ll just have to let go. We realize it can be near impossible (and admittedly, utterly useless) to give an ultimatum to a community, but we guess we just did!

Martin Luther putting 95 theses on the door of a church.

The JavaScript client OM

Developing solutions in the JavaScript client object model can be tedious and error prone. As a preferred way, it’s easier to start building a project using the managed client object model as it supports IntelliSense and debugging. When you’re finished, you can then port that version to the JavaScript OM. Alternatively, you can get some IntelliSense support for JavaScript by including the following line in an application page/site page/visual web part:

<% #if DEBUG %>
<script type=”text/javascript” src=”/_layouts/MicrosoftAjax.js” ></script> <script type=”text/javascript” src=”/_layouts/SP.debug.js”></script>
<% #endif %>

This is described in more detail here:

<% #if DEBUG %>
<script type=”text/javascript” src=”/_layouts/MicrosoftAjax.js” ></script> <script type=”text/javascript” src=”/_layouts/SP.debug.js”></script>
<% #endif %>

In, for example, a visual web part, the JavaScript OM js files have already been imported for you, so the following code is to wet your appetite and it updates a status field for a specific set of list items:

<script type=”text/javascript”>
    function onSucceeded(sender, args) {

        var itemEnum = listItems.getEnumerator();
        while (itemEnum.moveNext()) {
            var item = itemEnum.get_current();
            //alert(item.get_item(“Title”) + ” status:” + item.get_item(“MyStatus”) + ” : id ” + item.get_id());
                item.set_item(‘MyStatus’, ‘my new value’);


        context.executeQueryAsync(onSucceededStatusUpdate, onFailed);
    function onSucceededStatusUpdate(sender, args) {
        alert(“status updated”);

    var context;
    var web;
    var list;

    var listItems;
    var listItem;

    function InitClientOmContext() {
        context = new SP.ClientContext.get_current();
        web = context.get_web();
        list = web.get_lists().getByTitle(“MyPrintList”);
        listItem = list.getItemById(1);

    function UpdateStatus(arrItems) {
        try {

            // Note: Make sure that all fields are indeed part of the content type.
            // Dynamically create CAML query:
            var caml = “<View><ViewFields><FieldRef Name=’Id’/><FieldRef Name=’Title’/><FieldRef Name=’MyStatus’/></ViewFields><Query><Where><In><FieldRef Name=’ID’/><Values>”;

// arrItems is not included, but is a JavaScript array containing id’s
            for (i in arrItems) {
                caml += “<Value Type=’Number’>” + arrItems[i] + “</Value>”
            caml += “</Values></In></Where></Query></View>”;
            //var caml = “<View><Query><Where><Eq><FieldRef Name=’ID’/><Value Type=’Number’>2</Value></Eq></Where></Query></View>”;
            //var caml = “<View><ViewFields><FieldRef Name=’Title’/></ViewFields><RowLimit>5</RowLimit></View>”;
            //(<Where><FieldRef Name=”ID”/><Value>xx</Value></Where>)
            var camlQuery = new SP.CamlQuery();
            listItems = list.getItems(camlQuery);

            context.load(listItem, ‘Title’);
            context.executeQueryAsync(onSucceeded, onFailed);
        catch (err) {
            alert(“error in update status ” + err.Message);

    function onFailed(sender, args) {
        alert(“fail: ” + args.get_message() + “\n” + args.get_stackTrace());


Auditing in SharePoint Foundation?

Yes, you can, though it’s not supported via the GUI, see for details:

. Go to Start -> All Programs -> Microsoft SharePoint 2010 Products -> SharePoint 2010 Management Shell

2. When it is loaded you then run the following command to get your site collection object:

$site = Get-SPSite http://site_URL

3. If you don’t get errors then execute the following commands one by one to set audit options and update it:

$site.Audit.AuditFlags = [Microsoft.SharePoint.SPAuditMaskType]::Update


4. [Microsoft.SharePoint.SPAuditMaskType]::Update is a enum value of type SPAuditMaskType. You can have a look here for all possible values:

If you want to combine them then use -bxor in your script. Example for Delete and Update:

[Microsoft.SharePoint.SPAuditMaskType]::Update -bxor [Microsoft.SharePoint.SPAuditMaskType]::Delete

The GUI also doesn’t offer the option to show the audit logs, so you need to do that like so:


Or check out the audit log enabler at which apparently needs to be enhanced, like so (because it by default shows the results to all site members):

Title=”View Audit History”
<UrlAction Url=”~site/_layouts/AuditingLog/ItemAudit.aspx?ItemId={ItemId}&amp;ListId={ListId}”/>


Let’s start our day with a nice little tip about a jQuery plugin called Tipsy: , it provides Facebook-like tooltips effects and is quite nice.

TechNet Wiki

SharePoint 2010 Best Practices

There are at least three kinds of best practices. Often, when companies inform about best practices they actually mean: what does MS say is the best practice. It’s also possible that people are referring to what are in fact practices, but not necessarily the best ones. And then there are true best practices.

The following Wiki page: contains a considerable list of SharePoint 2010 Best Practices. They are not best practices of the first kind we’ve mentioned (as they are not officially dictated and endorsed by MS), so we’ll leave it to you to decide if they are of the 2nd or 3rd kind. Or, heck, you can even contribute if you like!

AD group or SharePoint group?

Should you use an AD group or a SharePoint group as the basis of your SharePoint farm security infrastructure: