Attachment.CreateAttachmentFromString メソッド

定義

文字列から添付ファイルを作成します。

オーバーロード

名前 説明
CreateAttachmentFromString(String, ContentType)

指定した文字列の内容と指定した ContentTypeを使用して、メール添付ファイルを作成します。

CreateAttachmentFromString(String, String)

指定した文字列のコンテンツと、指定した MIME コンテンツ タイプ名を使用して、メール添付ファイルを作成します。

CreateAttachmentFromString(String, String, Encoding, String)

指定した文字列のコンテンツ、指定した MIME コンテンツ タイプ名、文字エンコード、および添付ファイルの MIME ヘッダー情報を使用して、メール添付ファイルを作成します。

CreateAttachmentFromString(String, ContentType)

指定した文字列の内容と指定した ContentTypeを使用して、メール添付ファイルを作成します。

public:
 static System::Net::Mail::Attachment ^ CreateAttachmentFromString(System::String ^ content, System::Net::Mime::ContentType ^ contentType);
public static System.Net.Mail.Attachment CreateAttachmentFromString(string content, System.Net.Mime.ContentType contentType);
static member CreateAttachmentFromString : string * System.Net.Mime.ContentType -> System.Net.Mail.Attachment
Public Shared Function CreateAttachmentFromString (content As String, contentType As ContentType) As Attachment

パラメーター

content
String

この添付ファイルのコンテンツを含む String

contentType
ContentType

使用する多目的インターネット メール Exchange (MIME) プロトコル Content-Type ヘッダーを表すContentType オブジェクト。

返品

Attachment 型オブジェクト。

適用対象

CreateAttachmentFromString(String, String)

指定した文字列のコンテンツと、指定した MIME コンテンツ タイプ名を使用して、メール添付ファイルを作成します。

public:
 static System::Net::Mail::Attachment ^ CreateAttachmentFromString(System::String ^ content, System::String ^ name);
public static System.Net.Mail.Attachment CreateAttachmentFromString(string content, string name);
static member CreateAttachmentFromString : string * string -> System.Net.Mail.Attachment
Public Shared Function CreateAttachmentFromString (content As String, name As String) As Attachment

パラメーター

content
String

この添付ファイルのコンテンツを含む String

name
String

この添付ファイルに関連付けられているコンテンツ タイプの MIME コンテンツ タイプ名の値。

返品

Attachment 型オブジェクト。

注釈

コンテンツが ASCII 形式の場合、文字エンコードは ASCII に設定されます。 その他のすべての形式では、文字エンコードは utf-8 に設定されます。 既定のメディアの種類はプレーン テキストです。

コンテンツが ASCII 形式ではなく、エンコードが null の場合は、utf-8 エンコードが使用されます。

適用対象

CreateAttachmentFromString(String, String, Encoding, String)

指定した文字列のコンテンツ、指定した MIME コンテンツ タイプ名、文字エンコード、および添付ファイルの MIME ヘッダー情報を使用して、メール添付ファイルを作成します。

public:
 static System::Net::Mail::Attachment ^ CreateAttachmentFromString(System::String ^ content, System::String ^ name, System::Text::Encoding ^ contentEncoding, System::String ^ mediaType);
public static System.Net.Mail.Attachment CreateAttachmentFromString(string content, string name, System.Text.Encoding contentEncoding, string mediaType);
static member CreateAttachmentFromString : string * string * System.Text.Encoding * string -> System.Net.Mail.Attachment
Public Shared Function CreateAttachmentFromString (content As String, name As String, contentEncoding As Encoding, mediaType As String) As Attachment

パラメーター

content
String

この添付ファイルのコンテンツを含む String

name
String

この添付ファイルに関連付けられているコンテンツ タイプの MIME コンテンツ タイプ名の値。

contentEncoding
Encoding

Encoding。 この値は、null の場合もあります。

mediaType
String

この添付ファイルの MIME コンテンツ ヘッダー情報を含む String 。 この値は、null の場合もあります。

返品

Attachment 型オブジェクト。

適用対象