GetFolderType Class

The GetFolderType class represents a request to get folders from a mailbox.

Namespace: ExchangeWebServices
Assembly: EWS (in ews.dll)


<SerializableAttribute> _
<GeneratedCodeAttribute("wsdl", "2.0.50727.42")> _
<DesignerCategoryAttribute("code")> _
<XmlTypeAttribute(Namespace:="")> _
<DebuggerStepThroughAttribute> _
Public Class GetFolderType
    Inherits BaseRequestType
[GeneratedCodeAttribute("wsdl", "2.0.50727.42")] 
public class GetFolderType : BaseRequestType
[GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42")] 
public ref class GetFolderType : public BaseRequestType
/** @attribute SerializableAttribute() */ 
/** @attribute GeneratedCodeAttribute("wsdl", "2.0.50727.42") */ 
/** @attribute DesignerCategoryAttribute("code") */ 
/** @attribute XmlTypeAttribute(Namespace="") */ 
/** @attribute DebuggerStepThroughAttribute() */ 
public class GetFolderType extends BaseRequestType
GeneratedCodeAttribute("wsdl", "2.0.50727.42") 
public class GetFolderType extends BaseRequestType


The GetFolder operation is used to get regular, managed, and default folders from an Exchange mailbox.

Inheritance Hierarchy



The following example shows you how to get two folders. One of the folders is identified by the FolderId property and the other folder is identified by the DistinguishedFolderId property. The response will contain the properties that are defined for the AllProperties response shape and the additional information that is provided by the ManagedFolderInformation property if it applies to the folder.

static void GetFolder(ExchangeServiceBinding esb)
    // Identify the folders to get.
    FolderIdType folder1 = new FolderIdType();
    DistinguishedFolderIdType sentitems = new DistinguishedFolderIdType();
    folder1.Id = "AQAlAE1BQG";
    sentitems.Id = DistinguishedFolderIdNameType.sentitems;

    // Identify the folder properties to return.
    FolderResponseShapeType properties = new FolderResponseShapeType();
    PathToUnindexedFieldType ptuft = new PathToUnindexedFieldType();
    ptuft.FieldURI = UnindexedFieldURIType.folderManagedFolderInformation;
    PathToUnindexedFieldType[] ptufts = new PathToUnindexedFieldType[1] { ptuft };
    properties.AdditionalProperties = ptufts; 
    properties.BaseShape = DefaultShapeNamesType.AllProperties;

    // Form the get folder request.
    GetFolderType request = new GetFolderType();
    request.FolderIds = new BaseFolderIdType[2] { folder1, sentitems };
    request.FolderShape = properties;

        // Send the request and get the response.
        GetFolderResponseType response = esb.GetFolder(request);
        ArrayOfResponseMessagesType aormt = response.ResponseMessages;
        ResponseMessageType[] rmta = aormt.Items;

        foreach (ResponseMessageType rmt in rmta)
            if (rmt.ResponseClass == ResponseClassType.Success)
                FolderInfoResponseMessageType firmt;
                firmt = (rmt as FolderInfoResponseMessageType);
                BaseFolderType[] folders = firmt.Folders;

                foreach (BaseFolderType folder in folders)
                    if (folder is CalendarFolderType)
                        CalendarFolderType calendar;
                        calendar = (folder as CalendarFolderType);
                    else if (folder is ContactsFolderType)
                        // Handle the contacts folder.
                        // Handle SearchFolderType, TasksFolderType,
                        // and FolderType.
    catch (Exception e)

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003,

Target Platforms

Windows 98, Windows 2000, Windows 2000 Server, Windows CE, Windows Longhorn, Windows 98 Second Edition, Pocket PC, Smart Phone, Windows Server 2003, Windows XP Professional with Service Pack 2 (SP2)