Sharepoint Insight by Namwar Rizvi

Sharepoint Tips, Tricks and inside knowledge from real world experience by Namwar Rizvi

Posts Tagged ‘Object Model’

Verify your code with SharePoint Dispose Checker Tool

Posted by namwar on February 2, 2009


Today, a new tool  SharePoint Dispose Checker Tool  has been released at MSDN for checking your code against incorrect processing of IDisposable objects like. SPSite and SPWeb. This tool checks your assembly and identify potential problems of not disposing these objects. 

You can download SharePoint Dispose Checker Tool from here

and here is the great article from Paul Andrew (Microsoft Technical Product Manager for the SharePoint Developer Platform) about best practices and how to use this tool.

Posted in Bugs, Debugging, Object Model, Tools | Tagged: , , , , , , | Leave a Comment »

Update List Item without changing Modified By and Modified fields

Posted by namwar on September 30, 2008


If you update a field of a SPListItem obeject from code by using the following code snippet

item[“Title”]=”Updated Title”;

item.Update();

then you will notice that Modified By  and Modified field will be updated also. Sometimes, you just want to update fields without changing Modified By and Modified fields, you can do so by using 

item.SystemUpdate();

instead of item.Update();

SystemUpdate() method just updates the intended field values.

Posted in Object Model | Tagged: , , | Leave a Comment »

How to find End Date Pattern in Sharepoint Recurring Event

Posted by namwar on August 18, 2008


Sharepoint recurring events are similar to Outlook recurring events and provides several options to specify End Date pattern. If you find the type of End Date pattern in a recurring event you can find it in AfterProperties field of SPItemEventProperties object. Just check following

AfterProperties[“RecurrencePattern#EndDateRangeType:fRecurrence”]

Following are possible outputs and their meaning

  • 0   No end date.
  • 1   End after a specified number of occurrences. Requires that RecurrencePattern#repeatInstances:fRecurrence be specified.
  • 2   End by a specified date. Requires that RecurrencePattern#windowEnd:fRecurrence be specified.

Posted in Event Handler, Object Model | Tagged: | Leave a Comment »