CreateFolder 操作

CreateFolder 操作では、フォルダー、予定表フォルダー、連絡先フォルダー、タスク フォルダー、および検索フォルダーが作成されます。

CreateFolder 要求の例

説明

次の CreateFolder 要求の例は、メールボックス ルートに 2 つの新しいフォルダーを作成する要求を形成する方法を示しています。

コード

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Body>
    <CreateFolder xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ParentFolderId>
        <t:DistinguishedFolderId Id="msgfolderroot"/>
      </ParentFolderId>
      <Folders>
        <t:Folder>
          <t:DisplayName>Folder1</t:DisplayName>
        </t:Folder>
        <t:Folder>
          <t:DisplayName>Folder2</t:DisplayName>
        </t:Folder>
      </Folders>
    </CreateFolder>
  </soap:Body>
</soap:Envelope>

要求要素

要求では、次の要素が使用されます。

注:

これらの要素を記述するスキーマは、クライアント アクセス サーバーの役割がインストールされている MicrosoftExchange Server 2007 を実行しているコンピューターの EWS 仮想ディレクトリにあります。

CreateFolder 操作の要求メッセージの他のオプションを見つけるには、スキーマ階層を調べます。 CreateFolder 要素から開始します。

注:

calendar:Organizer プロパティを使用して制限付きの検索フォルダーを作成した場合、後続の get フォルダー呼び出しは、その場所に message:from プロパティを含む制限を返します。 これら 2 つのプロパティは、同じ基になる MAPI プロパティにマップされます。

CreateFolder 操作では、汎用フォルダー型要素を使用してフォルダーを作成し、 FolderClass 要素を設定する場合にのみ、カスタム フォルダー クラスの作成がサポートされます。

CreateFolder 応答の成功の例

説明

次の例は、CreateFolder 要求に対する正常な応答を示しています。 この例では、応答によって新しいフォルダーの識別子が返されます。

注:

読みやすくするために、フォルダー ID と変更キーが短縮されました。

コード

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="595" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <CreateFolderResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                          xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                          xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseMessages>
        <m:CreateFolderResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Folders>
            <t:Folder>
              <t:FolderId Id="AS4AUn==" />
            </t:Folder>
          </m:Folders>
        </m:CreateFolderResponseMessage>
        <m:CreateFolderResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Folders>
            <t:Folder>
              <t:FolderId Id="AS4AUn==" />
            </t:Folder>
          </m:Folders>
        </m:CreateFolderResponseMessage>
      </m:ResponseMessages>
    </CreateFolderResponse>
  </soap:Body>
</soap:Envelope>

成功した応答要素

応答では、次の要素が使用されます。

CreateFolder 操作の応答メッセージの他のオプションを見つけるには、スキーマ階層を調べます。 CreateFolderResponse 要素から開始します。

CreateFolder エラー応答

説明

次の例は、CreateFolder 要求に対するエラー応答を示しています。

コード

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="595" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <CreateFolderResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                          xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                          xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseMessages>
        <m:CreateFolderResponseMessage ResponseClass="Error">
          <m:MessageText>A folder with the specified name already exists.</m:MessageText>
          <m:ResponseCode>ErrorFolderExists</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
          <m:Folders />
        </m:CreateFolderResponseMessage>
      </m:ResponseMessages>
    </CreateFolderResponse>
  </soap:Body>
</soap:Envelope>

エラー応答要素

エラー応答では、次の要素が使用されます。

CreateFolder 操作のエラー応答メッセージの他のオプションを見つけるには、スキーマ階層を調べます。 CreateFolderResponse 要素から開始します。

関連項目

FindItem 操作

FindFolder 操作

CreateFolderType

フォルダーの作成 (Exchange Web サービス)