Het volgende script wat ik vond kopieert alle documenten uit je Outlook 2000 adresboek naar je Notes Adresboek.
Uit de Domino Developers conference afgelopen herfst 2001 in Parijs door: Larry Palm.
Om te doen wat jij wil moet je dus de Notes-schrijf acties vervangen door Lees acties (lotus script) en de Outlook-lees acties vervangen door schrijf acties (Visual Basic).
Succes en als het je gelukt is... post je script even!
<hier script>
Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" _
(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Function GetTempFolder() As String
' Returns the path to the user's Temp folder. To boot, Windows
' requires that a temporary folder exist, so this should always
' safely return a path to one. Just in case, though, check the
' return value of GetTempPath.
' Note: This function was taken directly from:
'
' Microsoft Office 2000/Visual Basic Programmer's Guide
' Returning Strings from DLL Functions
'
' on the MSDN October 2000 CD. Modifications were to make this
' a function (it was originally a property.)
Dim strTempPath As String
Dim lngTempPath As Long
Dim vbNullChar As Long
vbNullChar = 0
' Fill string with null characters.
strTempPath = String(144, vbNullChar)
' Get length of string.
lngTempPath = Len(strTempPath)
' Call GetTempPath, passing in string length and string.
If (GetTempPath(lngTempPath, strTempPath) > 0) Then
' GetTempPath returns path into string.
' Truncate string at first null character.
GetTempFolder = Left(strTempPath, InStr(1, strTempPath, Chr(vbNullChar)) - 1)
Else
GetTempFolder = ""
End If
End Function
Sub CopyToNotesMail()
' ***************************************************************
' Function: CopyToNotesMail
' Author: Larry Palm
' Date: 01/10/01
'
' Purpose: Copies all Outlook memos in personal inbox to a Notes
' mail file. Attachments are copied as well.
' ***************************************************************
On Error GoTo ErrorTrap
Dim pFolder As MAPIFolder ' Outlook personal folder
Dim pInbox As MAPIFolder ' Outlook personal inbox
Dim ns As NameSpace ' The object that allows us to access
' Outlook entities.
Dim i As Integer ' Counter
Dim pInboxItems As Items ' All items in personal inbox
Dim pItem As Variant ' Individual item in personal inbox
Dim rtItem As NotesRichTextItem ' For Notes attachments
Dim embObj As NotesEmbeddedObject ' For Notes attachments
Dim sTempFolder As String ' System temp directory
Dim db As NotesDatabase ' Notes mail file
Dim doc As NotesDocument ' Document that will be created in
' mail file.
Dim atts As Attachments ' For attachments in Outlook
Dim att As Attachment ' Single Outlook attachment
Const sPassword = "theview1" ' Replace with password for ID
Const sMailFile = "lpalm.nsf" ' Replace with mail file name
Const sServerName = "" ' Server name where mail file resides
' Set up the Notes stuff.
Dim session As New NotesSession
session.Initialize sPassword
Set db = session.GetDatabase(sServerName, sMailFile)
' Get the Outlook namespace so we can access items.
' ("MAPI" is the only option you can enter here.)
Set ns = Application.GetNamespace("MAPI")
'Get the personal inbox.
Set pFolder = ns.Folders("Personal Folders")
Set pInbox = pFolder.Folders("Inbox")
' Get all the items in the personal inbox.
Set pInboxItems = pInbox.Items
' Record location of the system temp folder.
' We will be detaching attachments to that folder.
sTempFolder = GetTempFolder()
' Cycle through all the items in the personal inbox.
Set pItem = pInboxItems.GetFirst
While Not (pItem Is Nothing)
' If an individual item is an Outlook mail memo,
' then copy it to the Notes mail file.
If pItem.Class = olMail Then
' Find any attachments in the Outlook mail memo.
Set atts = pItem.Attachments
' Create a Notes document and fill it with data from Outlook item.
Set doc = db.CreateDocument
Set rtItem = doc.CreateRichTextItem("Body")
Call rtItem.AppendText(pItem.Body)
Call doc.ReplaceItemValue("CopyTo", pItem.CC)
Call doc.ReplaceItemValue("DeliveredDate", Left(CStr(pItem.ReceivedTime), 10))
Call doc.ReplaceItemValue("From", pItem.SenderName)
Call doc.ReplaceItemValue("PostedDate", Left(CStr(pItem.CreationTime), 10))
Call doc.ReplaceItemValue("SendTo", pItem.To)
Call doc.ReplaceItemValue("Subject", pItem.Subject)
Call doc.ReplaceItemValue("Form", "Memo")
' Skip two lines.
rtItem.AddNewLine
rtItem.AddNewLine
' If there are attachments.
For i = 1 To atts.Count
' Get the ith attachment.
Set att = atts.Item(i)
' Detach it to the temp directory.
att.SaveAsFile (sTempFolder & att.FileName)
' Attach it into the Notes document.
Set embObj = rtItem.EmbedObject _
(EMBED_ATTACHMENT, "", sTempFolder & att.FileName)
' Add a newline to avoid RT 64K paragraph limit.
rtItem.AddNewLine
' Delete the file from the temporary directory.
Kill sTempFolder & att.FileName
Next i
' Save the Notes document.
Call doc.Save(True, True)
End If
' Get the next Outlook item.
Set pItem = pInboxItems.GetNext
Wend
' Give back the memory.
Set session = Nothing
Set db = Nothing
Set doc = Nothing
Set ns = Nothing
Set pFolder = Nothing
Set pInbox = Nothing
Set pItems = Nothing
Set pItem = Nothing
Set embObj = Nothing
Set rtItem = Nothing
Set atts = Nothing
Set att = Nothing
Set mItem = Nothing
Exit Sub
ErrorTrap:
Resume Next
End Sub
</hier script>