CQWP and Discussions

Hmm. Interesting problem – I had a Content Query Web Part (CQWP) that was displaying the Title for Discussions. Unfortunately when you clicked on them, they took you to the display form for the start of the thread, not the entire thing:

Okay, but could I get it to link to a view of the discussion thread itself?

Continue reading “CQWP and Discussions”

CQWP and Discussions

Programmatically evaluate SPWebApplication Policies

An interesting question came up on StackOverflow – how do you get the web application level policies for a Web app? In other words, the rights that you can grant to an entire web application (via central administration) – how do you get those in code?

Continue reading “Programmatically evaluate SPWebApplication Policies”

Programmatically evaluate SPWebApplication Policies

SharePoint: Check-Out vs Lock

I had been asked to look at a SharePoint event receiver that wasn’t behaving as it should. After a document had been checked in, it would set a property and update the item. However, we were getting an error:

SPException: The file “[File Name]” is locked for exclusive use by [User]

This was unfortunate – the user was the user who’d just been making changes, and the code was running after the document had been checked in – so what gives? Well, it turns out that the message is right – the file is locked, not checked out, and a lock is not the same as a check-out.
Continue reading “SharePoint: Check-Out vs Lock”

SharePoint: Check-Out vs Lock

Getting and Setting Properties in SharePoint

In SharePoint there are “property bags” on many elements of the system. For example, SPWebs and SPFolders have them, and methods like GetProperty() and SetProperty() to set them.

These methods accept and return objects. However, it’s nice to get values back in the same form as they were set. Continue reading “Getting and Setting Properties in SharePoint”

Getting and Setting Properties in SharePoint

Dealing with Large Lists Part 3 – The ContentIterator

In Part 1 we looked at the problem of the query throttle in SharePoint 2010, and in Part 2 we looked at some of the ways of getting around that. In this part, though, we’ll look at what I think is the best way – the ContentIterator control. Continue reading “Dealing with Large Lists Part 3 – The ContentIterator”

Dealing with Large Lists Part 3 – The ContentIterator

Dealing with Large Lists Part 2 – Coping with large queries

In Part 1 we looked at what throttling was, why queries could be throttled, the settings that control throttling, and some of the references to other useful information. In this post we’ll look at ways of trying to get your query to run anyway, depsite the throttle. “Writing Efficient Code In SharePoint Server” is a good introduction to the general principles. Continue reading “Dealing with Large Lists Part 2 – Coping with large queries”

Dealing with Large Lists Part 2 – Coping with large queries

Dealing with Large Lists Part 1 – What is throttling and how it causes difficulty

‘Large’ lists – lists with over a few thousand items – can cause problems when you’re developing for SharePoint, and the whole topic is kind of complicated. So what’s the problem?

Well, fundamentally the issue is inefficient queries being run against SharePoint lists. An inefficient query against a list with a small number of items isn’t a big deal, but with larger lists (over 5000 items) SQL server has to escalate from a row-level lock to a table-level lock. This can hold up other users while the table is locked.

So, what are the limits, what options are there with throttling, and what strategies are there for mitigating the effects of query throttling? Continue reading “Dealing with Large Lists Part 1 – What is throttling and how it causes difficulty”

Dealing with Large Lists Part 1 – What is throttling and how it causes difficulty