NameSpace.CompareEntryIDs メソッド (Outlook)

同じ Outlook アイテムを参照してください 2 つのエントリ ID の値を示す ブール 値を返します。

構文

expression. CompareEntryIDs( _FirstEntryID_ , _SecondEntryID_ )

NameSpace オブジェクトを返す式。

パラメーター

名前 必須 / オプション データ型 説明
FirstEntryID 必須 String 比較対象の一方のエントリ ID を指定します。
SecondEntryID 必須 String 比較対象のもう一方のエントリ ID を指定します。

戻り値

True の 場合、エントリ ID の値が同じ Outlook アイテムを参照してください。それ以外の場合、 false を指定 します。

注釈

1 つのオブジェクトは、2 つの異なるバイナリ値で表すことができるため、エントリ ID を直接比較することはできません。 このメソッドを使用すると、2 つのエントリ ID が同じオブジェクトを表しているかどうかを判断できます。

次のVisual Basic for Applications (VBA) の例では、指定した AppointmentItem オブジェクトの開催者に関連付けられているエントリ識別子と、指定した Recipient オブジェクトのエントリ識別子を CompareEntryIDs メソッドを使用して比較し、開催者と指定した受信者が同じユーザーを表す場合は True を返します。

Function IsRecipientTheOrganizer( _ 
 
 ByVal Appt As Outlook.AppointmentItem, _ 
 
 ByVal Recipient As Outlook.Recipient) As Boolean 
 
 
 
 Dim objAddrEntry As Outlook.AddressEntry 
 
 Dim objPropAc As Outlook.PropertyAccessor 
 
 Dim strOrganizerEntryId As String 
 
 Dim bytResult() As Byte 
 
 Dim objRecipientUser As Outlook.ExchangeUser 
 
 Dim objOrganizerUser As Outlook.ExchangeUser 
 
 Dim blnReturn As Boolean 
 
 
 
 'Property tag for Organizer EntryID 
 
 Const PR_SENT_REPRESENTING_ENTRYID As String = _ 
 
 "http://schemas.microsoft.com/mapi/proptag/0x00410102" 
 
 
 
 ' Retrieve an AddressEntry object reference for the 
 
 ' specified recipient. 
 
 Set objAddrEntry = Recipient.AddressEntry 
 
 
 
 ' If the address entry represents an Exchange user 
 
 ' or Exchange remote user, retrieve an 
 
 ' ExchangeUser object reference for the sender and 
 
 ' compare the EntryID value of that object with 
 
 ' the EntryID of the specified recipient. 
 
 If objAddrEntry.AddressEntryUserType = _ 
 
 OlAddressEntryUserType.olExchangeUserAddressEntry _ 
 
 Or objAddrEntry.AddressEntryUserType = _ 
 
 OlAddressEntryUserType.olExchangeRemoteUserAddressEntry Then 
 
 
 
 ' Attempt to retrieve an ExchangeUser 
 
 ' object reference for the specified 
 
 ' recipient. 
 
 Set objRecipientUser = objAddrEntry.GetExchangeUser() 
 
 
 
 If objRecipientUser Is Nothing Then 
 
 ' An Exchange user could not be retrieved 
 
 ' for the specified recipient. 
 
 blnReturn = False 
 
 Else 
 
 ' Retrieve the EntryID property value of the organizer. 
 
 ' The Organizer property of the AppointmentItem object only 
 
 ' contains a string representation of the name of the 
 
 ' organizer, so the PR_SENT_REPRESENTING_ENTRYID property value 
 
 ' is instead retrieved, using the PropertyAccessor object 
 
 ' associated with the appointment item. 
 
 Set objPropAc = Appt.PropertyAccessor 
 
 bytResult = objPropAc.GetProperty( _ 
 
 PR_SENT_REPRESENTING_ENTRYID) 
 
 
 
 If Not IsEmpty(bytResult) Then 
 
 ' Convert the binary value retrieved from the 
 
 ' PR_SENT_REPRESENTING_ENTRYID property into 
 
 ' a string value for comparison. 
 
 strOrganizerEntryId = _ 
 
 objPropAc.BinaryToString(bytResult) 
 
 
 
 ' Attempt to retrieve an ExchangeUser 
 
 ' object reference for the organizer. 
 
 Set objOrganizerUser = Appt.Application.Session. _ 
 
 GetAddressEntryFromID(strOrganizerEntryId).GetExchangeUser() 
 
 
 
 If objOrganizerUser Is Nothing Then 
 
 ' An Exchange user could not be retrieved 
 
 ' for the organizer. 
 
 blnReturn = False 
 
 Else 
 
 ' Compare the EntryIDs of the organizer 
 
 ' and the specified recipient. 
 
 blnReturn = Appt.Application.Session. _ 
 
 CompareEntryIDs( _ 
 
 objRecipientUser.ID, _ 
 
 objOrganizerUser.ID) 
 
 End If 
 
 End If 
 
 End If 
 
 End If 
 
 
 
EndRoutine: 
 
 ' Clean up 
 
 Set objOrganizerUser = Nothing 
 
 Set objRecipientUser = Nothing 
 
 Set objAddrEntry = Nothing 
 
 Set objPropAc = Nothing 
 
 
 
 ' Return the results. 
 
 IsRecipientTheOrganizer = blnReturn 
 
 
 
 Exit Function 
 
 
 
ErrRoutine: 
 
 Debug.Print Err.Number & " - " & Err.Description, _ 
 
 vbOKOnly Or vbCritical, _ 
 
 "IsRecipientTheOrganizer" 
 
 
 
 GoTo EndRoutine 
 
End Function

関連項目

NameSpace Object

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

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