对,一个按钮将Outlook联系人导入Notes

大家好,才是真的好。

outlook的邮件和联系人导入到Notes里面真心很容易,为了证明这一点,我们今天先来看看如何一键导入Outlook联系人到Notes里面。

对,你没看错,是一键导入

因为,我们采用的是最强大的代码方式。

怎么说,为了证明效果,我们先看看Notes里面现在是没有联系人的。

而Oultook里面是有很多:

为此,我们在Notes客户机中,创建一个按钮或代理程序——就创建代理吧,点开你的邮箱或联系人,创建菜单中,有一个代理,然后把下列代码拷贝粘贴进去,代码如下:

 

Const olContactsFolder = 10

Const olContactItem = 2

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim doc As NotesDocument

Dim OL As Variant

Dim OLContact As Variant

Dim number As Integer

number = 0

Set db = New NotesDatabase("","names.nsf")

' Set doc = New NotesDocument(db)

Print "Connecting to Outlook..."

Print "Opening ..."

Set OL = CreateObject("Outlook.Application")

Set myNS = OL.GetNameSpace("MAPI")

'For the next two lines, using the GetDefaultFolder will always openup the default

'Contacts folder, while the PickFolder line prompts for a folder.

' Set myFolder = myNS.GetDefaultFolder (olContactsFolder)

Set myFolder = myNS.PickFolder()

Set myItems = myFolder.Items

Set myItem= myItems.GetFirst

Print "Starting import from Outlook file..."

For x = 1 To myItems.count

Set doc = db.CreateDocument

With myItem

doc.mailaddress = .email1address

doc.firstname = .firstname

doc.lastname = .lastname

doc.title = .title

doc.FirstName = .FirstName

doc.MiddleInitial = .MiddleName

doc.Suffix = .Suffix

doc.CompanyName = .CompanyName

doc.Department = .Department

doc.JobTitle = .JobTitle

doc.OfficeStreetAddress = .BusinessAddressStreet

doc.OfficeState = .BusinessAddressState

doc.OfficeZip = .BusinessAddressPostalCode

doc.OfficeCountry = .BusinessAddressCountry

doc.StreetAddress = .HomeAddressStreet

doc.City = .HomeAddressCity

doc.State = .HomeAddressState

doc.Zip = .HomeAddressPostalCode

doc.Country = .HomeAddressCountry

doc.OfficeFAXPhoneNumber = .BusinessFaxNumber

doc.OfficePhoneNumber = .BusinessTelePhoneNumber

' doc.CellPhoneNumber = .MobilePhoneNumber

doc.HomeFaxPhoneNumber = .HomeFaxNumber

doc.PhoneNumber = .HomeTelePhoneNumber

doc.PhoneNumber_6 = .PagerNumber

doc.Assistant = .AssistantName

doc.Birthday = .Birthday

doc.Categories = .Categories

doc.Children = .Children

doc.MailAddress = .Email1Address

doc.Keywords = .Categories

doc.Location = .OfficeLocation

doc.Manager = .ManagerName

' doc.Comment = .Notes

doc.Spouse = .Spouse

doc.WebSite = .WebPage

' doc.OLItemID=.StoreID

doc.OLEntryID=.EntryID

' Set rtitem = doc.GetFirstItem( "Body" )

' Call rtitem.AppendText(myItem.Body)

End With

doc.form = "Person"

doc.Type = "Person"

success = doc.ComputeWithForm( False, False )

Call doc.Save( True, True )

number=number+1

Set myItem= myItems.GetNext

Print "Completed : " & number

Next

Print "Disconnecting from Outlook..."

Msgbox "Complete. Imported " & number & " entries."

Set myNS = Nothing

Set myFolder = Nothing

Set myItems = Nothing

Set myItem = Nothing

ol.quit

效果如下图:

保存关闭后,我们点击操作菜单下的导入Outlook联系人选项,如下图:

接着程序会自动打开Outlook程序,你只需要选择联系人所在的文件夹,如下图:

Notes便开始疯狂地导入联系人:

一瞬间,就导入了数百个联系人,十分惊人:

为了证明结果,现在,我们打开Notes联系人看看:

是不是忒简单强大?

最后欢迎搜索公众号“协作者”来关注我。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值