MailItem.RTFBody プロパティ (Outlook)

リッチ テキスト形式でMicrosoft Outlookアイテムの本文を表す バイト 配列を設定または返します。 値の取得と設定が可能です。

構文

RTFBody

'MailItem' オブジェクトを表す変数。

注釈

Microsoft Visual Basic for Applications (VBA) の StrConv 関数、または C# または Visual Basic の System.Text.Encoding.AsciiEncoding.GetString() メソッドを使用して、バイト配列を文字列に変換します。

Microsoft Visual Basic for Applications (VBA) と C# で次のコード サンプルでは、アクティブなインスペクターで予定のリッチ テキスト形式の本文が表示されます。 MailItem はこのコードの動作にアクティブなインスペクターである必要があります。

Sub GetRTFBodyForMail() 
 
 Dim oMail As Outlook.MailItem 
 
 Dim strRTF As String 
 
 If Application.ActiveInspector.CurrentItem.Class = olMail Then 
 
 Set oMail = Application.ActiveInspector.CurrentItem 
 
 strRTF = StrConv(oMail.RTFBody, vbUnicode) 
 
 Debug.Print strRTF 
 
 End If 
 
End Sub
private void GetRTFBodyForMail() 
 
{ 
 
 if (Application.ActiveInspector().CurrentItem is Outlook.MailItem) 
 
 { 
 
 Outlook.MailItem mail = 
 
 Application.ActiveInspector().CurrentItem as Outlook.MailItem; 
 
 byte[] byteArray = mail.RTFBody as byte[]; 
 
 System.Text.Encoding encoding = new System.Text.ASCIIEncoding(); 
 
 string RTF = encoding.GetString(byteArray); 
 
 Debug.WriteLine(RTF); 
 
 } 
 
} 
 

関連項目

MailItem オブジェクト

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。