3

Lotus Notes メールをハード ドライブにエクスポート (保存) する必要があります。添付ファイルを HDD に保存する方法はわかりましたが、メール全体を保存する方法がわかりません。

以下のコードは、添付ファイルをエクスポートする方法を示しています。メールを保存するように変更する方法を提案できますか? PS-私はプログラミングが初めてです。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domino;
using System.Collections;

namespace ExportLotusAttachments
{
  class Class1
  {
    public void ScanForEmails()
    {
      String textBox1 = "c:\\1";
      NotesSession session = new NotesSession();
      session.Initialize("");
      NotesDbDirectory dir = null;
      dir = session.GetDbDirectory("");
      NotesDatabase db = null;
      db = dir.OpenMailDatabase();
      NotesDatabase NDb = dir.OpenMailDatabase(); //Database connection

      //ArrayList that will hold names of the folders
      ArrayList LotusViews2 = new ArrayList(); 

      foreach (NotesView V in NDb.Views)
      {
        if (V.IsFolder && !(V.Name.Equals("($All)")))
        {
          NotesView getS = V;
          LotusViews2.Add(getS.Name);
        }
      }

      foreach (String obj in LotusViews2)
      {
        NotesDocument NDoc;
        NotesView nInboxDocs = NDb.GetView(obj);
        NDoc = nInboxDocs.GetFirstDocument();
        String pAttachment;

        while (NDoc != null)
        {
          if (NDoc.HasEmbedded && NDoc.HasItem("$File"))
          {
            object[] AllDocItems = (object[])NDoc.Items;
            foreach (object CurItem in AllDocItems)
            {
              NotesItem nItem = (NotesItem)CurItem;
              if (IT_TYPE.ATTACHMENT == nItem.type)
              {
                String path = textBox1;
                pAttachment = ((object[])nItem.Values)[0].ToString();

                if (!System.IO.Directory.Exists(path))
                {
                  System.IO.Directory.CreateDirectory(textBox1);
                }

                try
                {
                  NDoc.GetAttachment(pAttachment).ExtractFile(@path + pAttachment);
                }
                catch { }
              }
            }
          }
          NDoc = nInboxDocs.GetNextDocument(NDoc);
        }
      }
    }
  }
}
4

2 に答える 2

2

Bob Babalanによるこの投稿では、 Javaを使用してロータスドキュメントをエクスポートする方法について説明しています。同じ原則がC#またはVBでも機能するはずです。ドキュメントはMIMEに変換され、ディスクに書き込まれます。

または、バージョン8.5.3(8.5.1から始まったと思います)では、メールファイルからファイルシステムにドラッグアンドドロップするだけです。

于 2011-12-10T08:41:45.200 に答える