联系人 FileAs 名称

Contact FileAs name

我使用以下文档来修复现有联系人的 FileAs 条目。它不适用于公司名称的联系人。

https://docs.microsoft.com/en-us/office/vba/outlook/concepts/address-book/programmatically-change-the-display-format-for-all-contacts

由于 Firstname 和 Lastname 字段为空,因此 FileAs 条目为空(" "+" "+" ")。

如何查找空白的 FileAs 字段并将 CompanyName 字段设置为 FileAs 字段?

会是这样的:

Set contactItems = items.Restrict("[MessageClass]='IPM.Contact'")
For Each itemContact In contactItems
'The underscore on the line below breaks the line into two lines.
'You need the left side of the equals for each condition in the if cant do or " "
    If itemContact.Firstname = "" Or itemContact.Firstname = " " _
    Or itemContact.lastname = "" or itemContact.lastname = " " Then
        itemContact.FileAs = itemContact.Company
        itemContact.Save
    end if
Next