FindFolderType Class
The FindFolderType class represents a request to find folders in a mailbox.
Namespace: ExchangeWebServices
Assembly: EWS (in ews.dll)
Syntax
'Declaration
<SerializableAttribute> _
<XmlTypeAttribute(Namespace:="https://schemas.microsoft.com/exchange/services/2006/messages")> _
<GeneratedCodeAttribute("wsdl", "2.0.50727.42")> _
<DebuggerStepThroughAttribute> _
<DesignerCategoryAttribute("code")> _
Public Class FindFolderType
Inherits BaseRequestType
[SerializableAttribute]
[XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages")]
[GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[DebuggerStepThroughAttribute]
[DesignerCategoryAttribute("code")]
public class FindFolderType : BaseRequestType
[SerializableAttribute]
[XmlTypeAttribute(Namespace=L"https://schemas.microsoft.com/exchange/services/2006/messages")]
[GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42")]
[DebuggerStepThroughAttribute]
[DesignerCategoryAttribute(L"code")]
public ref class FindFolderType : public BaseRequestType
/** @attribute SerializableAttribute() */
/** @attribute XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages") */
/** @attribute GeneratedCodeAttribute("wsdl", "2.0.50727.42") */
/** @attribute DebuggerStepThroughAttribute() */
/** @attribute DesignerCategoryAttribute("code") */
public class FindFolderType extends BaseRequestType
SerializableAttribute
XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages")
GeneratedCodeAttribute("wsdl", "2.0.50727.42")
DebuggerStepThroughAttribute
DesignerCategoryAttribute("code")
public class FindFolderType extends BaseRequestType
Remarks
The FindFolder operation finds subfolders of an identified folder. The FindFolder operation returns only the first 512 bytes of any streamable property. For Unicode, the FindFolder operation returns the first 255 characters by using a null-terminated Unicode string. Use the GetFolder operation to get additional folder properties.
Restrictions on folder properties, but not item properties, are permitted. Sorting functionality is not available for FindFolder responses. Grouped queries are not available for FindFolder queries.
Inheritance Hierarchy
System.Object
ExchangeWebServices.BaseRequestType
ExchangeWebServices.FindFolderType
Example
The following example shows a FindFolder query that returns the following results:
A deep traversal search of the Inbox.
All the properties that are defined for the Default FolderShape in a FindFolder operation.
All folders that have a display name of SentOnlyToMe. The case does not have to match.
A fractional paging scheme that returns at most a single folder that starts after the first folder.
static void FindFolder(ExchangeServiceBinding esb)
{
// Create the request and specify the traversal type.
FindFolderType findFolderRequest = new FindFolderType();
findFolderRequest.Traversal = FolderQueryTraversalType.Deep;
// Define the properties to be returned in the response.
FolderResponseShapeType responseShape = new FolderResponseShapeType();
responseShape.BaseShape = DefaultShapeNamesType.Default;
findFolderRequest.FolderShape = responseShape;
// Identify which folders to search.
DistinguishedFolderIdType[] folderIDArray = new DistinguishedFolderIdType[1];
folderIDArray[0] = new DistinguishedFolderIdType();
folderIDArray[0].Id = DistinguishedFolderIdNameType.inbox;
// Add the folders to search to the request.
findFolderRequest.ParentFolderIds = folderIDArray;
// Restriction based on the folder display name.
RestrictionType restriction = new RestrictionType();
PathToUnindexedFieldType fldrRestriction = new PathToUnindexedFieldType();
fldrRestriction.FieldURI = UnindexedFieldURIType.folderDisplayName;
// Identify the folder name to restrict on.
ContainsExpressionType contains = new ContainsExpressionType();
contains.ContainmentMode = ContainmentModeType.Substring;
contains.ContainmentModeSpecified = true;
contains.ContainmentComparison = ContainmentComparisonType.IgnoreCase;
contains.ContainmentComparisonSpecified = true;
contains.Item = fldrRestriction;
contains.Constant = new ConstantValueType();
contains.Constant.Value = "SentOnlyToMe";
restriction.Item = contains;
findFolderRequest.Restriction = restriction;
// Define the paging scheme for the result set.
FractionalPageViewType fpvt = new FractionalPageViewType();
fpvt.MaxEntriesReturned = 1;
fpvt.MaxEntriesReturnedSpecified = true;
fpvt.Numerator = 1;
fpvt.Denominator = 4;
findFolderRequest.Item = fpvt;
try
{
// Send the request and get the response.
FindFolderResponseType findFolderResponse = esb.FindFolder(findFolderRequest);
// Get the response messages.
ResponseMessageType[] rmta = findFolderResponse.ResponseMessages.Items;
foreach (ResponseMessageType rmt in rmta)
{
FindFolderResponseMessageType ffrmt = (rmt as FindFolderResponseMessageType);
FindFolderParentType ffpt = ffrmt.RootFolder;
BaseFolderType[] folders = ffpt.Folders;
foreach (BaseFolderType folder in folders)
{
// Check folder type
if (folder is CalendarFolderType)
{
CalendarFolderType fldr = (folder as CalendarFolderType);
// TODO: Handle calendar folder
}
else
{
// TODO: Handle folders, search folders, tasks folders,
// and contacts folder
}
}
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
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.
Platforms
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)
See Also
Reference
FindFolderType Members
ExchangeWebServices Namespace
Other Resources
Finding Folders (Exchange Web Services)
FindFolder Operation
FindFolder