次の方法で共有


FindFolderType クラス

定義

クラスは FindFolderType 、メールボックス内のフォルダーを検索する要求を表します。

public ref class FindFolderType : ExchangeWebServices::BaseRequestType
public class FindFolderType : ExchangeWebServices.BaseRequestType
Public Class FindFolderType
Inherits BaseRequestType
継承
FindFolderType

次の例は、次の結果を返す FindFolder クエリを示しています。

  1. 受信トレイのディープ トラバーサル検索。
  2. FindFolder 操作で Default FolderShape に対して定義されているすべてのプロパティ。
  3. SentOnlyToMe の表示名を持つすべてのフォルダー。 大文字と小文字は一致する必要はありません。
  4. 最初のフォルダーの後から始まる最大 1 つのフォルダーを返す小数ページング スキーム。
static void FindFolder(ExchangeServiceBinding esb)
{
    // Create the request and specify the traversal type.
    FindFolderType <span class="label">findFolderRequest</span> = new FindFolderType();
<span class="label">findFolderRequest</span>.Traversal = FolderQueryTraversalType.Deep;

    // Define the properties to be returned in the response.
    FolderResponseShapeType responseShape = new FolderResponseShapeType();
    responseShape.BaseShape = DefaultShapeNamesType.Default;
<span class="label">findFolderRequest</span>.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.
<span class="label">findFolderRequest</span>.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;
<span class="label">findFolderRequest</span>.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;
<span class="label">findFolderRequest</span>.Item = fpvt;

    try
    {
        // Send the request and get the response.
        FindFolderResponseType findFolderResponse = esb.FindFolder(<span class="label">findFolderRequest</span>);

        // 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);
    }
}

注釈

FindFolder 操作は、識別されたフォルダーのサブフォルダーを検索します。 FindFolder 操作は、ストリーミング可能なプロパティの最初の 512 バイトのみを返します。 Unicode の場合、FindFolder 操作は、null で終わる Unicode 文字列を使用して最初の 255 文字を返します。 GetFolder 操作を使用して、追加のフォルダー プロパティを取得します。

フォルダープロパティに対する制限は許可されていますが、項目プロパティには制限されません。 並べ替え機能は、FindFolder 応答では使用できません。 グループ化されたクエリは、FindFolder クエリでは使用できません。

コンストラクター

FindFolderType()

コンストラクターは FindFolderType 、 クラスの新しいインスタンスを FindFolderType 初期化します。

プロパティ

FolderShape

プロパティは FolderShape 、クエリ セットの図形を取得または設定します。 このプロパティは必須です。 これは、読み取り/書き込みプロパティです。

Item

プロパティは Item 、クエリ結果セットが応答でページングされる方法を説明するページングの種類を取得または設定します。 このプロパティは、 または オブジェクトをIndexedPageViewTypeFractionalPageViewType取得または設定します。 このプロパティは省略可能です。 これは、読み取り/書き込みプロパティです。

ParentFolderIds

プロパティは ParentFolderIds 、FindFolder 操作で検索するフォルダーを取得または設定します。 このプロパティは必須です。 これは、読み取り/書き込みプロパティです。

Restriction

プロパティは Restriction 、フォルダー クエリを定義する検索パラメーターを取得または設定します。 このプロパティは省略可能です。 これは、読み取り/書き込みプロパティです。

Traversal

プロパティは Traversal 、フォルダーの検索に使用されるトラバーサル スキームを取得または設定します。 このプロパティは必須です。 これは、読み取り/書き込みプロパティです。

適用対象