Common Coding Issues When Using the SharePoint Object Model
June 18, 2009 Leave a comment
A link which I reference often over at MSDN is the Best Practices: Common Coding Issues When Using the SharePoint Object Model. I wanted to share it with any readers that may be unaware of its existence, and, an easy place for me to find it if I ever lose the bookmark. I generally browse it before jumping into a new project, just to make sure I am following the best practices when writing custom code against the API. At the time of writing a web part, event receiver, or workflow, it may be for a small set of data, but, you need to plan for growth.
Example: If you hear “this list will never have more than one or two hundred items in it”, you better plan for having several thousand, or tens of thousands. Needs change, it is a fact of life and business. By following some simple coding practices as outlined above, you can be ahead of the game, and not have to iterate through thousands upon thousands of list items you are querying for only a small subset, then you will not have to worry about angry users wondering why a page takes 45 seconds to load with only a single web part on it – yours.