PropertyAccessor.BinaryToString 方法 (Outlook)

Value 指定的字节数组转换为 String

语法

expressionBinaryToString( _Value_ )

表达 一个代表 PropertyAccessor 对象的变量。

参数

名称 必需/可选 数据类型 说明
必需 Variant 代表要转换的字节数组。

返回值

十六进制 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 支持和反馈,获取有关如何接收支持和提供反馈的指南。