赎回问题....获取olExchangeRemoteUserAddressEntry的SMTP地址很慢。有更快的方法吗? [英] Redemption question.... slow to get SMTP address for olExchangeRemoteUserAddressEntry. Is there a faster way?

查看:70
本文介绍了赎回问题....获取olExchangeRemoteUserAddressEntry的SMTP地址很慢。有更快的方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我们最近遇到了一个奇怪的"延迟"。对于我们的一些用户。最终,我们设法将其固定在试图检索Outlook.Recipient的SMTP地址的一段代码上

Hello all. We were recently faced with a strange "delay" for some of our users. Eventually we managed to pin it down on a piece of code that was trying to retrieve the SMTP address for an Outlook.Recipient




        Public Shared Function GetRecipientSMTPAddress(ByVal oRep As Outlook.Recipient) As String

            Dim sEmailAddress As String = String.Empty

            Try
                If Not oRep Is Nothing Then
                    If Not oRep.Address Is Nothing Then
                        sEmailAddress = oRep.Address.ToString().ToLower()
                    End If
                End If
            Catch

            End Try
            If sEmailAddress.IndexOf("@") < 0 Then
                Try
                    If Not oRep Is Nothing Then
                        If Not oRep.AddressEntry Is Nothing Then
                            If oRep.AddressEntry.AddressEntryUserType = Outlook.OlAddressEntryUserType.olExchangeUserAddressEntry Then
                                sEmailAddress = oRep.AddressEntry.GetExchangeUser().PrimarySmtpAddress.ToLower()
                            End If
                        End If
                    End If
                Catch ex As Exception

                End Try
            End If
            If sEmailAddress.IndexOf("@") < 0 Then
                Try
                    If Not oRep Is Nothing Then
                        If Not oRep.AddressEntry Is Nothing Then
                            sEmailAddress = g_rdSession.GetAddressEntryFromID(oRep.AddressEntry.ID).SMTPAddress.ToLower()
                        End If
                    End If
                Catch

                End Try
            End If

            Return sEmailAddress

        End Function

延迟的原因最终被追溯到最后的IF语句

The cause of the delay was eventually tracked down to the last IF statement

g_rdSession

是当前Session的Redemption表示,一个Redemption.RDOSession - 它没有得到第二个IF语句中的地址,因为

is the Redemption representation of the current Session, a Redemption.RDOSession - it did not get the address in the second IF statement because

oRep.AddressEntry.AddressEntryUserType

实际上不是olExchangeUserAddressEntry,而是olExchangeRemoteUserAddress输入,这意味着它没有在第二个IF语句中处理,因此需要在最后一个处理。

was actually not an olExchangeUserAddressEntry, but a olExchangeRemoteUserAddressEntry, which means it didn't get processed in the second IF statement and therefore it needed to be processed in the last.




我的问题:延迟的原因是什么,更重要的是,是否有办法更快地获取olExchangeRemoteUserAddressEntry的SMTP地址?

My question: what is the reason for the delay and, more importantly, is there a way to get the SMTP address for a olExchangeRemoteUserAddressEntry faster?

推荐答案

在触摸Recipient.AddressEntry之前,检查收件人表中的SMTP地址是否可用 - 使用Recipient.PropertyAccessor.GetProperty读取PR_SMTP_ADDRESS属性(DASL名称" http://schemas.microsoft.com/mapi/proptag/0x39FE001F")。
如果不存在,请阅读PR_ADDRTYPE属性(" http://schemas.microsoft.com/mapi / proptag / 0x3002001F ") - 这相当于AddressEntry对象上的Type属性,但不幸的是,
Recipient对象不会公开。如果是"SMTP",只需使用Recipient.Address属性。并且只有当它不是时,使用上面需要Recipient.AddressEntry的函数。

Before even touching Recipient.AddressEntry, check if the SMTP address is available in the recipient table - use Recipient.PropertyAccessor.GetProperty to read the PR_SMTP_ADDRESS property (DASL name "http://schemas.microsoft.com/mapi/proptag/0x39FE001F"). If it is not present, read the PR_ADDRTYPE property ("http://schemas.microsoft.com/mapi/proptag/0x3002001F") - this is equivalent to Type property on the AddressEntry object, which Recipient object unfortunately does not expose. If it is "SMTP", just use the Recipient.Address property. And only if it is not, use your function above that needs Recipient.AddressEntry.

查看OutlookSpy的约会(clic kIMessage按钮,转到GetRecipeintTable选项卡)以检查是否PR_SMTP_`ADDRESS属性可用

Take a look at the appointment with OutlookSpy (clic kIMessage button, go to the GetRecipeintTable tab) to check if the PR_SMTP_`ADDRESS property is available


这篇关于赎回问题....获取olExchangeRemoteUserAddressEntry的SMTP地址很慢。有更快的方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆