UiPath Documentation
studiox
2024.10
true

StudioX user guide

最終更新日時 2026年4月30日

チュートリアル: Outlook メールを反復処理し、添付ファイルを保存する

このチュートリアルでは、Outlook 検索フォルダーのすべてのメールの添付ファイルをユーザーのコンピューターに保存するオートメーションを作成します。

We will create a project and start by adding a Use Desktop Outlook App activity to indicate the Outlook account to use. In this activity, we will add a For Each Email activity to indicate that we want to iterate through the emails in a folder. We will then add the activities to repeat inside For Each Email.

  1. コンピューターと Outlook の検索フォルダーに Temp フォルダーを作成する

    1. コンピューターの C: ドライブのルートに Temp という名前のフォルダーを作成します。
    2. Outlook を開き、[フォルダー] ペインで [検索フォルダー] を右クリックし、[新しい検索フォルダー] を選択します。
    3. [新しい検索フォルダー] ウィンドウで、[カスタム検索フォルダーを作成する] > [選択] を選択します。
    4. [検索フォルダーのカスタマイズ] ウィンドウで、[名前] ボックスに「Last week's attachments」と入力し、[条件] を選択します。
    5. [検索フォルダーの条件] ウィンドウの [メッセージ] タブで、[時間の条件] の横にあるドロップダウン メニューから [受信日時][先週] を選択します。
    6. [詳細設定] タブで、[添付ファイル] を選択し、隣接するドロップダウン メニューから 1 つ以上の添付ファイルを選択します。
    7. [OK] を 3 回クリックしてウィンドウを閉じて、検索フォルダーを保存します。
  2. プロジェクトを設定します。

  3. Outlook アカウントをプロジェクトに追加する

    1. [アクティビティ] パネルで [メール] タブを選択し、[デスクトップ版 Outlook アプリを使用] をダブルクリックします。アクティビティがデザイナー パネルに追加されます。

    2. このアクティビティの [アカウント] フィールドには、あらかじめ既定のメール アカウントが入力されています。別のアカウントを使用する場合は、ドロップダウン メニューから選択します。

      [参照名] フィールドは既定値 Outlook のままとして、オートメーションでアカウントを参照するときは、この名前を使用します。

  4. Outlook フォルダーのメッセージを反復処理する

    1. [アクティビティ] パネルで [繰り返し (各メール)] アクティビティをドラッグし、[デスクトップ版 Outlook アプリを使用] アクティビティ内にドロップします。

    2. In the For Each Email activity, click Plus ドキュメントの画像 on the right side of the In emails from field, and then select Outlook > [Search Folders] > [Last week's attachments] to select the search folder created in the account Outlook. Your selection is displayed in the In emails from field as Last week's attachments.

      これで、Outlook の検索フォルダーの [Last week's attachments] のメールを反復処理するように指定したことになります。

      ドキュメントの画像

  5. 各メッセージの添付ファイルをコンピューターのフォルダーに保存する

    1. In the Activities panel, drag the Save Email Attachments activity and drop it inside the For Each Email activity.

    2. [メールの添付ファイルを保存] アクティビティで、次の操作を行います。

      • Click Plus ドキュメントの画像 on the right side of the Email field, and then select CurrentMail to indicate that the email whose attachments you want to save is the current email you are iterating through.

      • Click Browse ドキュメントの画像 next to the Save to folder field, and then browse to and select the folder on your computer where to save the attachments. For this example, we created a folder called Temp on the C drive of the computer.

        ドキュメントの画像

    3. StudioX のリボンで [保存] をクリックしてオートメーションを保存し、[実行] をクリックしてオートメーションを実行します。

      The attachments from each email in the Outlook folder Temp are saved to the Temp folder on the computer.Download example

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得