* You are viewing the archive for the ‘SharePoint’ Category

SharePoint folder performance

In a recent project we had the idea to use folders as a starting position for queries to optimize the performance a bit further. To set a starting folder on an SPQuery object you need to set the Folder property to the SPFolder object you wish to search.

This is what this post is about: how to get that folder (by name) in C# in a performant matter.

Let’s get down to business: what I would like to do is write a function that takes in a folder name and it returns me the SPFolder object (in the … Continue Reading

List deleted / deleting event receivers not being hit when a site gets deleted

This will be a very short blog with a finding we did today. If you have event receivers on your lists like:

  • ListDeleting
  • ListDeleted

These don’t get hit when the parent site gets deleted, meaning you have to be very careful with it. If you really want to execute the logic that is contained within those events, you need to do it in the WebDeleted / WebDeleting events aswell.

Preventing the use of webparts in specific sites

For a recent project we had a business request to prevent the use of certain webparts in a specific site definition.

Our initial investigation showed us that there is not that many information to be found on this subject so we decided it was time to share some information on the subject.

There are a few ways of implementing this, but each one of them has its advantages and drawbacks.

You can for example – in the case of custom webparts – implement custom logic to forcefully prevent the use of webparts in certain sites. This big … Continue Reading

Getting random user profiles

Getting random user profiles is quite an easy task, but there is not much to be found on the internet about it except for some less than ideal solutions in my opinion.

My ideal solution would be something that is scalable and takes into account the security of the User Profile Application.

The solutions that I found all shared the same approach:

  • Open the User Profile Application Service
  • Get the count of user profiles
  • Get X numbers between 0 and the number of user profiles
  • Get those user profiles

I do have some issues with this which I would like to point out:

The count of the number … Continue Reading