Disposing of SharePoint Services Objects

August 19, 2007

When using the SharePoint Services objects make sure to dispose of them properly since some of them, such as the SPSite class and SPWeb class objects, use unmanaged code. Here is a reference for how and when to properly dispose:

http://msdn2.microsoft.com/en-us/library/aa973248.aspx

The common objects used are SPSite and SPWeb which should be disposed of.

Note that the SPSite object if obtained from the GetContextSite() method does not need to be disposed of.


Follow

Get every new post delivered to your Inbox.