Using Folder Content Class Values

Topic Last Modified: 2006-06-12

All Exchange store folders and items have content class values that denote their intended purpose. A folder is an item that is a collection of other items. Exchange store applications can use content class values to determine how to process the data that an item contains.

You can check the content class using a Microsoft® ActiveX® Data Objects (ADO) Record object before you create instances of any Collaboration Data Objects (CDO) objects. To do so, you can check the value of the DAV:contentclass property. Alternatively, if you know the item is a folder by checking its DAV:iscollection property values, you can create an instance of a CDOFolder object from a URL or from an ADO Record object and then check the IFolder.ContentClass property.

Example

Visual Basic

Dim CC as String
Dim Rec As New ADODB.Record
With Rec
  .Open strFolderURL
  CC = .Fields("DAV:contentclass")
  If CC = "urn:content-classes:contactfolder" Then
   '
  Else If CC = "urn:content-classes:mailfolder" Then
   '
  End If
  Rec.Close
End With


  'To check a folder Content-Class using a CDO Folder object
Dim iFldr As New CDO.Folder
Dim iDsrc as CDO.IDataSource
Set iDsrc = iFldr
iDsrc.Open strFolderURL
If iFldr.ContentClass = "urn:content-classes:mailfolder" Then
   '
End If