Today, as I was working on a custom list form for SharePoint, I needed to get some information on versioning and content approval for the items in the list. It turned out to be quite straight-forward. Here is what I did.
Wednesday, March 30, 2011
How to programmatically get content approval information on a list item
Saturday, March 26, 2011
Getting the publishing permission levels
SharePoint has a small number of built-in permission levels, or role definitions as they are called code-wise. Several of these are easy to access through the SPRoleType enum.
However, the publishing features create new permission levels that are not found in SPRoleType. Although they can be accessed using code such as web.RoleDefinitions["Approve"], this requires hardcoded strings, and is not practical in a localized setting. Luckily, there is a way to access the localization of these permission levels. I got the solution from Alexey Sadomov, and present it here in a slightly modified form.
Wednesday, March 23, 2011
Working with custom permission levels in SharePoint
Creating custom permission levels in SharePoint is not hard. You can do it through the GUI, by navigating to the_layouts/addrole.aspx page on any site.
But you might want to do it through code instead, deploying the new permission level with a feature and assigning it to groups and users. This also includes more options for defining the permission level than the GUI does. Below I show how to define your own permission levels.
Should you want to see what permissions are used for the standard permission levels, then this link is a good place to look.
Saturday, March 19, 2011
How to add images to picture library with thumbnails using CAML
Sunday, March 13, 2011
How to create lookup fields in CAML that works
For my first post on this blog I will demonstrate how to avoid the most common problem with deploying SharePoint lookup fields.
Basically, a lookup field is defined using CAML just like any other SharePoint field. However, there is a problem: You need to add a reference to the lookup list. There are several ways to achieve this. Below, I have outlined three standard ways to do this, and a fourth way, my preferred, that handles the problems inherent in each of the other three solutions.