ContentDisposition.DispositionType プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ContentDisposition.DispositionType プロパティの意味・解説 

ContentDisposition.DispositionType プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

電子メールの添付データの配置タイプを取得または設定します。

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

Dim instance As ContentDisposition
Dim value As String

value = instance.DispositionType

instance.DispositionType = value
public string DispositionType { get;
 set; }
public:
property String^ DispositionType {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_DispositionType ()

/** @property */
public void set_DispositionType (String value)
public function get DispositionType
 () : String

public function set DispositionType
 (value : String)

プロパティ値
配置タイプを格納している String。値の制限はありませんが、通常、いずれかの DispositionType 値です。

例外例外
例外の種類条件

ArgumentNullException

設定操作として指定した値が null 参照 (Visual Basic では Nothing) です。

ArgumentException

設定操作として指定した値が String.Empty ("") です。

解説解説
使用例使用例

このプロパティの値を設定する方法を次のコード例に示します。

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();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ContentDisposition クラス
ContentDisposition メンバ
System.Net.Mime 名前空間



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

ContentDisposition.DispositionType プロパティのお隣キーワード
検索ランキング

   

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



ContentDisposition.DispositionType プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS