3

テキストベースの添付ファイル (txt、doc など) を解析しようとしています。ただし、バイナリ情報自体に到達できないようです。ファイル名を取得でき、ファイルを一時フォルダーに保存してそこから開くことができますが、それは面倒です。

添付ファイルを保存、読み取り、削除せずにコンテンツにアクセスする方法はありますか?

4

2 に答える 2

3

Microsoft スキーマを使用して添付ファイルのコンテンツを取得できます -

   private void GetAttachmentContent(Attachments attachments)
    {
        foreach (Attachment attachment in attachments)
        {
            //microsoft schema to get the attachment content
            string AttachSchema = "http://schemas.microsoft.com/mapi/proptag/0x37010102";
            byte[] filebyte = (byte[])attachment.PropertyAccessor.GetProperty(AttachSchema);
        }
    }

コードファイルの Microsoft.CSharp.dll を参照する必要があります

于 2015-08-03T02:38:28.937 に答える
3

ここで償還が役立ちます。SafeMailItem.Attachments コレクションには、プロパティ「AsText」を持つ Attachment オブジェクトがあります。

http://www.dimastr.com/redemption/

76メル

于 2009-05-06T10:29:45.017 に答える