[XML] Velden exporteren uit Lotus Notes naar Word

Pagina: 1
Acties:

  • Loque
  • Registratie: November 2000
  • Laatst online: 08-07-2023
Hallo allemaal,

Ik zit met het volgende,

Vanuit Lotus Notes Adressenboek een contact persoon opzoeken, vervolgens op een knop drukken die er voor zorgt dat die contact persoon gegevens mee worden genomen naar een Word Sjabloon. De gegevens moeten in dat sjabloon dan weer op de juiste plaatst worden in gevoerd.

Met het volgende commando kun je word opstarten met een bepaald sjabloon:
@Command( [Execute]; "C:Documents and Settings\\zuidema\\My Documents\\Koop\\Brief Nederlands.dot")

Ik zit hier nou al een 2 weken mee en ik heb echt overal gezocht, maar ik kan geen juiste manier vinden om bepaalde velden te exporteren naar word.

Heeft iemand ervaring hiermee via XML code? Ben er inmiddels achter dat het niet via een wizard oid kan. (ook de help bied geen uitkomst.)

I'm not in denial, im just selective in the reality I choose to believe. (Calvin & Hobbes)


Verwijderd

<ben bezig>

Verwijderd

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>

  • Loque
  • Registratie: November 2000
  • Laatst online: 08-07-2023
Eerst wil ik je ff bedanken voor je hulp. Maar.. (er is altijd een maar) dit is vb code, en aangezien ik het in Domino Designer onder een knop moet stoppen moet het XML zijn. Opzich krijg ik van dit script wel een idee hoe het bv van Outlook naar word moet. En aangezien ik geen programmeur ben (opdracht is uitzoeken of het gemakkelijk is om voor elkaar te krijgen) wil ik er niet TE diep in duiken.

Misschien is hier nog ergens een goeie XML programmeur die mij een stapje op weg kan helpen?

I'm not in denial, im just selective in the reality I choose to believe. (Calvin & Hobbes)


Verwijderd

Dit hoeft niet met XML maar kan gewoon met Lotusscript. Zoek op Notes.net maar eens op "OLE and Word".

Kijk ook hier maar eens naar:
http://www.notes.net/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/8678bd978a6d75d785256b3d004b6d22?OpenDocument


Suc6