【发布时间】:2023-03-18 04:28:01
【问题描述】:
我从用户那里获得了交换在线地址,但我想转换或以某种方式获取他们的 SMTP 地址。
我不确定如何从 Email1Address 获取 SMTP 地址。
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)
Set objItems = objContactsFolder.Items
For Each obj In objItems
'Test for contact and not distribution list
If obj.Class = olContact Then
Set objContact = obj
With objContact
If .Email1Address <>"" Then
'I want to add the SMTP-Address after the .LastNameAndFirstName of a User
strFileAs = .LastNameAndFirstName
.Email1DisplayName= strFileAs
.Save
End If
End With
End If
Err.Clear
Next
【问题讨论】:
-
什么是你试过的代码,什么没用?
-
搜索
ResolveDisplayNameToSMTP- 您要查找的代码是由 Sue Mosher 编写的。