DispositionTypeNames.Attachment フィールドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DispositionTypeNames.Attachment フィールドの意味・解説 

DispositionTypeNames.Attachment フィールド

メモ : このフィールドは、.NET Framework version 2.0新しく追加されたものです。

添付データが、電子メール メッセージ添付されるファイルとして表示されることを指定します

名前空間: System.Net.Mime
アセンブリ: System (system.dll 内)
構文構文

使用例使用例

添付データ配置タイプ設定するコード例次に示します

public static void CreateMessageWithAttachment4(string
 server, string to)
{
    // Specify the file to be attached and sent.
    // This example uses a file on a UNC share.
    string file = @"\\share3\c$\reports\data.xls";
    // Create a message and set up the recipients.
    MailMessage message = new MailMessage(
       "ReportMailer@contoso.com",
       to,
       "Quarterly data report",
       "See the attached spreadsheet.");

    // Create  the file attachment for this e-mail message.
    Attachment data = new Attachment("qtr3.xls", MediaTypeNames.Application.Octet);
    // Add time stamp information for the file.
    ContentDisposition disposition = data.ContentDisposition;
    disposition.CreationDate = System.IO.File.GetCreationTime(file);
    disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
    disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
    disposition.DispositionType = DispositionTypeNames.Attachment;
    // Add the file attachment to this e-mail message.
    message.Attachments.Add(data);
    //Send the message.
    SmtpClient client = new SmtpClient(server);
    // Add credentials if the SMTP server requires them.
    client.Credentials = (ICredentialsByHost)CredentialCache.DefaultNetworkCredentials;
    client.Send(message);
    // Display the message headers.
    string[] keys = message.Headers.AllKeys;
    Console.WriteLine("Headers");
    foreach (string s in
 keys)
    {
        Console.WriteLine("{0}:", s);
        Console.WriteLine("    {0}", message.Headers[s]);
    }
    data.Dispose();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DispositionTypeNames クラス
DispositionTypeNames メンバ
System.Net.Mime 名前空間
SmtpClient クラス
MailMessage クラス
Attachment.ContentDisposition プロパティ
System.Net.Mail 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からDispositionTypeNames.Attachment フィールドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDispositionTypeNames.Attachment フィールドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDispositionTypeNames.Attachment フィールド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

DispositionTypeNames.Attachment フィールドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DispositionTypeNames.Attachment フィールドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS