Platform SDK: Exchange 2000 Server

IFolder Interface

[This is preliminary documentation and subject to change.]

The IFolder interface defines methods and properties used to access a folder in a Microsoft® Exchange 2000 Server public or private information store, or a folder in a Web Store.

IID
CD000132-8B95-11D1-82DB-00C04FB1625D
Extends
IDispatch

Member Summary

Properties

Name Type Description
Configuration

IConfiguration

IConfiguration*

The Configuration object for the folder.
ContentClass

[Visual Basic,VBScript] String

[C++,IDL] BSTR

The content class of the folder.
DataSource

(Read-Only)

IDataSource

[C++,IDL]IDataSource*

The IDataSource interface on the object.
Description

[Visual Basic,VBScript] String

[C++,IDL] BSTR

The description of the folder.
DisplayName

(Read-Only)

[Visual Basic,VBScript] String

[C++,IDL] BSTR

The display name of the folder.
EmailAddress

(Read-Only)

[Visual Basic,VBScript] String

[C++,IDL] BSTR

The email address of this folder.
Fields

(Read-only)

[Visual Basic,VBScript] ADODB.Fields

[C++,IDL] Fields*

The ADO Fields collection for the folder. The object contains the properties associated with this folder item.
HasSubFolders

(Read-only)

[Visual Basic,VBScript] Boolean

[C++,IDL] VARIANT_BOOL

Indicates whether the folder contains subfolders.
ItemCount

(Read-only)

[Visual Basic,VBScript] Long

[C++,IDL] long

The number of non-folder items in the folder.
UnreadItemCount

(Read-only)

[Visual Basic,VBScript] Long

[C++,IDL] long

The number of items in the folder not marked as read.
VisibleItemCount

(Read-only)

[Visual Basic,VBScript] Long

[C++,IDL] long

The number of visible (not hidden) items in the folder.

Methods

Name Description
GetInterface Returns a specified interface on this object. Acts as a QueryInterface or Set method for scripting languages.

Remarks

The CDO Folder object exposes an implementation of the IFolder interface. Folder objects provide access to information about a folder in a Microsoft Exchange private or public information store, or a Web Store. Such information includes the number of non-folder items in the folder, the number of unread messages, and whether the folder has sub-folders.

Many of the properties exposed on the IFolder interface correspond one-to-one with properties in the IFolder.Fields collection. You can use either the interface properties or the properties in the Fields collection; both methods provide access to folder properties.

The IFolder.DataSource property return interfaces on the object. Other interfaces may exist, such as IMailRecipient. To access these interfaces, scripting languages use the IFolder.GetInterface method. The IMailRecipient interface is present for a Folder object if the CDO for Exchange Management COM component is installed. Other languages, such as C++ and Microsoft® Visual Basic® can use also an appropriate interface navigation method such as QueryInterface and Set.

Example

[Visual Basic]
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Exchange 2000 Library

Function CreateFolder( Url as String, _
                       ContentClass as String, _
                       Description as String ) 
  Set Fldr = New CDO.Folder
  With Fldr
    .ContentClass = ContentClass
    .Description  = Description
    .DataSource.SaveTo Url, , _
                       adModeReadWrite, _
                       adCreateCollection Or adCreateOverWrite

  End With
  Set CreateFolder = Fldr

End Function
[VBScript]
Const adModeReadWrite    = 3
Const adCreateCollection = 8192
Const adCreateOverwrite  = 67108864

Function CreateFolder( Url, ContentClass, Description ) 
  Set Fldr = CreateObject("CDO.Folder")
  With Fldr
    .ContentClass = ContentClass
    .Description  = Description
    .DataSource.SaveTo Url, , _
                       adModeReadWrite, _
                       adCreateCollection Or adCreateOverWrite

  End With
  Set CreateFolder = Fldr

End Function
[C++]
HRESULT CreateFolder(BSTR Url, BSTR contentclass, BSTR Description, IFolder** ppFldr) {

   /* Assume these headers:
   *
   * #import <msado15.dll> no_namespace
   * #import <cdoex.dll>   no_namespace
   *
   */

   if(ppFldr == NULL)
      return E_POINTER;

   IDataSource* pDsrc = NULL;
   HRESULT hr = CoCreateInstance(
      __uuidof(Folder),
      NULL,
      CLSCTX_INPROC_SERVER,
      __uuidof(IFolder),
      reinterpret_cast<void**>(ppFldr));

   if(FAILED(hr)) 
      return hr;

   hr = (*ppFldr)->put_ContentClass(contentclass);
   hr = (*ppFldr)->put_Description(Description);

   if(FAILED(hr)) {
      (*ppFldr)->Release();
      *ppFldr = NULL;
      return E_UNEXPECTED;
   }

   hr = (*ppFldr)->QueryInterface(
      __uuidof(IDataSource),
      reinterpret_cast<void**>(&pDsrc));

   if(FAILED(hr)) {
      (*ppFldr)->Release();
      *ppFldr = NULL;
      return E_UNEXPECTED;
   }

   hr = pDsrc->raw_SaveTo(
      Url,
      NULL,
      adModeReadWrite,
      (RecordCreateOptionsEnum) 
         (   adCreateCollection | 
            adCreateOverwrite
         ),
      adOpenSource,
      NULL,
      NULL);

   if(FAILED(hr)) {
      (*ppFldr)->Release();
      *ppFldr = NULL;
   }

   pDsrc->Release();
   pDsrc = NULL;
   return hr;
}