PropertyAccessor.BinaryToString メソッド (Outlook)

Value で指定されたバイト配列を String に変換します

構文

BinaryToString( _Value_ )

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

パラメーター

名前 必須 / オプション データ型 説明
必須 バリアント型 (Variant) 変換するバイト配列を指定します。

戻り値

変換後の値を表す 16 進数 String

注釈

PropertyAccessor オブジェクトを使用する場合の型変換の詳細については、「プロパティを取得および設定するためのベスト プラクティス」を参照してください。

Outlook オブジェクト モデルでは、アイテムのエントリ ID を取得するのには、アイテム オブジェクトの EntryID プロパティを公開します。 このプロパティは、MAPI プロパティの PR_ENTRYID 、その項目の値を表す文字列です。 を除き、 EntryID プロパティも PropertyAccessor.GetProperty メソッドを使用してアイテムの PR_ENTRYID の値を取得し、 PropertyAccessor.BinaryToString を使用してその値を文字列に変換できます。 この文字列は、同じアイテムの EntryID プロパティの値と一致する必要があります。 次のコードは、 PropertyAccessor.GetProperty メソッドによって返されるエントリ ID と、受信トレイ内の各アイテムの EntryID プロパティによって返されるエントリ ID が等しいかどうかを示しています。

Sub TestEntryIDs() 
 Dim oMsg As Object 
 Dim oFolder As Outlook.Folder 
 Dim oItems As Outlook.Items 
 Dim oPA As Outlook.PropertyAccessor 
 Dim EntryID1 As String, EntryID2 As String, EntryIDProperty As String 
 
 'This is the MAPI property PR_ENTRYID referenced with its MAPI proptag namespace 
 EntryIDProperty = "http://schemas.microsoft.com/mapi/proptag/0x0FFF0102" 
 Set oFolder = Application.Session.GetDefaultFolder(olFolderInbox) 
 Set oItems = oFolder.Items 
 For Each oMsg In oItems 
 Set oPA = oMsg.PropertyAccessor 
 'First use the EntryID property of the item 
 EntryID1 = oMsg.EntryID 
 'Then use the PropertyAccessor 
 EntryID2 = oPA.BinaryToString(oPA.GetProperty(EntryIDProperty)) 
 'The string equivalents of the two Entry IDs should be the same 
 If EntryID1 <> EntryID2 Then 
 Debug.Print "Error obtaining EntryID for " & oMsg.Subject 
 End If 
 Next 
End Sub

関連項目

PropertyAccessor オブジェクト

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

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