This documentation is archived and is not being maintained.

SPBuiltInFieldId._Category Field

Windows SharePoint Services 3

Returns a string that represents the category of the specified Windows SharePoint Services object.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public static readonly Guid _Category

SPSite oSiteCollection = SPContext.Current.Site;

SPWebCollection collWebsites = oSiteCollection.AllWebs;

foreach (SPWeb oWebsite in collWebsites)


SPListCollection collLists = oWebsite.Lists;

foreach (SPList oList in collLists)


if (oList.BaseType == SPBaseType.DocumentLibrary)


SPDocumentLibrary oDocumentLibrary = (SPDocumentLibrary)oList;

if (!oDocumentLibrary.IsCatalog && oList.BaseTemplate !=



// get the '_Category' column string of the object

SPField guidCategory =







Certain objects implement the IDisposable interface and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Best Practices: Using Disposable Windows SharePoint Services Objects.