INECO Forum Overzicht Overzicht Aanmelden Aanmelden Registreer Registreer Profiel Profiel Ledenlijst Ledenlijst Groepen Groepen Zoeken Zoeken

Script om SMPT adressen uit een Exchange Adresboek te importeren
 
 
 
 
 Geplaatst   Bericht 
Marcel Rothuizen

Marcel Rothuizen
 

Aanmelddatum: 10-11-2000
Woonplaats: Heteren (Gld)
Datum: 21-05-2003 10:43:32    Bericht: Script om SMPT adressen uit een Exchange Adresboek te importeren

Bij een migratie van een Exchange omgeving naar Lotus Notes 6 gebruikte ik de standaard Administrator tool van de Notes Admin Client om personen uit Exchange te importeren.
Dit werkte best aardig.
Het enige probleem dat ik tegen kwam was dat deze klant voor elk persoon een zestal smtp adressen (aliassen) had ingevuld in Exchange.
Om deze in Lotus Notes in het Shortname veld te krijgen heb ik een simpele oplossing bedacht:
een agent in het NAB met de volgende code:

Option Public
Option Declare


Const CdoPR_EMS_AB_PROXY_ADDRESSES = &H800F101E

Sub Initialize

Dim session As New NotesSession
Dim db As NotesDatabase
Dim View As NotesView
Dim doc As NotesDocument

Dim Outlook As Variant
Dim myNameSpace As Variant
Dim objSession As Variant
Dim objAddressList As Variant
Dim Contact As Variant
Dim objField As Variant

Dim Item As NotesItem

Dim i As Integer
Dim Count As Integer

Dim Person As String
Set db = Session.CurrentDatabase
Set view = db.GetView( "($Flat)" )
Set Outlook = CreateObject("Outlook.Application")
Set myNameSpace = Outlook.GetNameSpace("MAPI")
Set objSession = Outlook.CreateObject("MAPI.Session")
objSession.Logon "Instellingen van Microsoft Exchange" 'Vul hier de naam van het profiel in
'objSession.Logon (NewSession:=False)
Set objAddressList = objSession.AddressLists("Klant adresboek") 'Vul hier de naam van het adresboek in

If (objAddressList Is Nothing) Then
Msgbox "Personal Addressbook not found."
Exit Sub
End If
Dim test As String
Dim AddValue As Integer
Count = objAddressList.AddressEntries.Count
For i = 1 To count
Set Contact = objAddressList.AddressEntries.Item(i)
Let Person = Contact.Name
Let Person = Fulltrim( Person )
Set doc = view.GetDocumentByKey( Person )
If Doc Is Nothing Then
Msgbox Person & " Not Found!"
Goto NextDoc
End If
If Doc.GetItemValue("Type")(0) = "Person" Then
Set Item = Doc.GetFirstItem("ShortName")
Set objField = Contact.Fields(CdoPR_EMS_AB_PROXY_ADDRESSES)
Forall v In objField.Value
If Instr(Lcase(v),"smtp:")>0 Then
Test = Strright( Lcase(v), "smtp:")
Forall t In Item.Values
If Lcase(t) = test Then AddValue = False
End Forall
If AddValue = True Then
Call item.AppendToTextList(Test)
End If
AddValue = True
End If
End Forall
Call doc.Save( False, True )
End If
NextDoc:
Next
Stop
Set Outlook = Nothing
Set myNameSpace = Nothing
Set objSession = Nothing
Set objAddressList = Nothing
Set Contact = Nothing
Set objField = Nothing

End Sub


Met een heel klein stukje code bespaarde me dat een hoop type werk!

Dit is slechts een voorbeeld van wat je met een beetje LotusScript allemaal kunt doen.
Zo is het zeer eenvoudig om informatie uit te wisselen met Outlook (of andere applicaties).

 E-mail Website ICQ MSNM Skype Hyves LinkedIn 
Zoek in afgelopen ok
 
   Overzicht / Lotus Notes Ontwikkeling / Lotusscript  
Pagina 1 van 1 

IBM LOTUS NOTES migratie doet u samen met INECO

Powered by Lotus Domino R8.5.3 on Fedora Core 14 Dit  forum is gemaakt door Intranet &  Network Consultancy. © 2011.
Voor vragen of opmerkingen  kunt u contact opnemen met:  .
Deze site is gemaakt met Lotus Notes R8.5.3 en draait op Fedora Core 14.

INECO Support Contract banner