If you’re like me and you do a fair bit of object model programming, you’ve likely seen this error before. More specifically, the error is as follows: Unhandled Exception: Microsoft.SharePoint.SPException: Invalid data has been used to update the list item. The field you are trying to update may be read only. There are probably more [...]
Continue Reading →How To Change the Default EditForm, NewForm and DispForm
Problem You’ve developed some custom new, edit and display application pages that are stored in the _layouts directory. Let’s assume the filenames are newform.aspx, dispform.aspx and editform.aspx. You now want to change the properties of your custom list so that any new, edit or display requests point to your custom pages. If you open up [...]
Continue Reading →Performance Considerations With the PeopleEditor Control
I was recently working on a Black Ninja Software project for a client of ours where performance became an issues for one of the custom application pages we had developed. I plan to write up a more detailed report on how I managed to cut the load times of this particular page in half using [...]
Continue Reading →Validating a PeopleEditor Control on PostBack
Let’s talk about validation and the PeopleEditor control. There doesn’t seem to be a consensus on how this is supposed to be done so I’ll outline my findings and what eventually worked for me. I’ll start by explaining what I was attempting to do. I have a PeopleEditor control on a custom application page. My [...]
Continue Reading →Understanding BreakRoleInheritance() Can Reset AllowUnsafeUpdates
I ran into a problem recently where I was attempting to update the permissions on an SPListItem within code but ran into the following error: Updates are currently disallowed on GET requests. To allow updates on a GET, set the ‘AllowUnsafeUpdates’ property on SPWeb. Now I’m quite familiar with this error, and it’s one of [...]
Continue Reading →How to Add a Rich Text Editor to your Custom Application Pages
This article will talk specifically about how to add a Rich Text Editor to your custom application pages. When initially doing some research on this topic, I found a lot of information, but not anything useful that I could actually implement. Here are my steps for adding a control of this type to your pages: [...]
Continue Reading →How to Write an SPQuery to Sort Your List
If you’re working with an SPListItemCollection, you might have the need to sort the data that stored in the collection. The best way I’ve found to do this is to build an SPQuery object and use that to actually query for the information. Using an object of this type makes it possible to send in [...]
Continue Reading →How to Use the PeopleEditor Control: Saving Data
The PeopleEditor control is a common control that you’ll find implemented throughout SharePoint. If you’re building any custom web parts or application pages, you may want users to enter people specific information. The PeopleEditor is a good choice, however, there isn’t much out there in terms of documenting it’s use. Hopefully the information below will [...]
Continue Reading →How to Use the PeopleEditor Control: Loading Data
This post was really planned as a Part 2 to the first post I made about saving data from the PeopleEditor control. My aim for this entry is to tackle the reverse scenario: reading data from a field of type Person or Group and loading it into a PeopleEditor control. If you have any troubles [...]
Continue Reading →SPWeb.SiteUsers vs SPWeb.Users
Update: I recently ran into this issue again and discovered that there is in fact a way to ensure that the user exists before creating the user object — the EnsureUser method of the SPWeb class. According to MSDN this method “Checks whether the specified login name belongs to a valid user of the Web [...]
Continue Reading →