Description Property
Topic Last Modified: 2006-06-13
A description of the folder.
Applies To
Type Library
Microsoft CDO for Exchange 2000 Library
DLL Implemented In
CDOEX.DLL
Syntax
Property Description As String
HRESULT get_Description(BSTR* pVal);HRESULT put_Description(BSTR Val);
Parameters
- pVal
 Returns the value of the Description property as a reference to a BSTR.
- Val
 Sets the value of the Description property to the value of the BSTR.
Remarks
This property is normally set by administrators to provide an administrative note for the folder.
Examples
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Exchange 2000 Library
' Note: It is recommended that all input parameters be validated before being used.
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
  End With
  Set CreateFolder = Fldr
End Function
' Note: It is recommended that all input parameters be validated before being used.
Function CreateFolder( Url, ContentClass, Description )
  Set Fldr = CreateObject("CDO.Folder")
  With Fldr
    .ContentClass = ContentClass
    .Description  = Description
    On Error Resume Next
    .DataSource.Open Url, , adModeReadWrite
    If Err.Number <> 0 Then
      Err.Clear
      .DataSource.SaveTo Url, , _
                        adModeReadWrite, _
                       adCreateCollection
      If Err.Number <> 0 Then
       ' Handle error
      End If
    End If
  End With
  On Error Goto 0
  Set CreateFolder = Fldr
End Function
/*
 You must have the following paths in your
 INCLUDE path.
 %CommonProgramFiles%\system\ado
 %CommonProgramFiles%\microsoft shared\cdo
*/
#ifndef _CORE_EXAMPLE_HEADERS_INCLUDED
#define _CORE_EXAMPLE_HEADERS_INCLUDED
#import <msado15.dll> no_namespace
#import <cdoex.dll> no_namespace
#include <iostream.h>
#endif
// Note: It is recommended that all input parameters be validated before being used.
IFolderPtr CreateFolder(bstr_t url, bstr_t contentclass, bstr_t description) {
   if(url == bstr_t(""))
      throw _com_error(E_POINTER);
   _ConnectionPtr Conn(__uuidof(Connection));
   IDataSourcePtr pDsrc(__uuidof(Folder));
   Conn->Provider = "ExOLEDB.DataSource";
   try {
      Conn->Open(url,bstr_t(),bstr_t(),-1);
   }
   catch(_com_error e) {
      throw e;
   }
   IFolderPtr pFldr = pDsrc;
   pFldr->ContentClass = contentclass;
   pFldr->Description  = description;
   try {
      pDsrc->SaveTo(
         url,
         variant_t((IDispatch*)Conn,true),
         adModeReadWrite,
         (RecordCreateOptionsEnum)
            (   adCreateCollection
            ),
         adOpenSource,
         bstr_t(),
         bstr_t());
   }
   catch(_com_error e) {
      cerr << "Error saving folder to store" << endl;
      throw e;
   }
   // close connection
   Conn->Close();
   Conn = NULL;
   return pFldr;
}