Düzenle

Aracılığıyla paylaş


PropertyAccessor.BinaryToString method (Outlook)

Converts the array of bytes specified by Value to a String.

Syntax

expression. BinaryToString( _Value_ )

expression A variable that represents a PropertyAccessor object.

Parameters

Name Required/Optional Data type Description
Value Required Variant Represents the array of bytes to be converted.

Return value

A hexadecimal String that represents the converted value.

Remarks

For more information on type conversion when using the PropertyAccessor object, see Best Practices for Getting and Setting Properties.

Example

The Outlook object model exposes an EntryID property for item objects to obtain the Entry ID of an item. This property is a string representing the value of the MAPI property, PR_ENTRYID, of that item. Aside from the EntryID property, you can also use the PropertyAccessor.GetProperty method to obtain the value of PR_ENTRYID for an item, and use PropertyAccessor.BinaryToString to convert that value to a string. This string should match the EntryID property value for the same item. The following code sample shows the equivalence of the Entry ID returned by the PropertyAccessor.GetProperty method and the Entry ID returned by the EntryID property for each item in the Inbox.

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

See also

PropertyAccessor Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.