so ich habe nun den teil fertig mit dem ich das Template stempeln lassen sollte:
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim dbTarget As NotesDatabase
Dim notesColl As NotesNoteCollection
Dim sharedFieldDoc As NotesDocument
Dim currentDoc As NotesDocument
Dim noteID As String
Set currentDoc = ws.CurrentDocument.Document
Set dbTarget = session.GetDatabase(Cstr(currentDoc.GetItemValue("serverPath")(0)),Cstr(currentDoc.GetItemValue("filePath")(0)),False)
Set notesColl = dbTarget.CreateNoteCollection(False)
notesColl.SelectSharedFields = True
Call notesColl.BuildCollection
noteID = notesColl.GetFirstNoteId
Do Until noteID = ""
Set sharedFieldDoc = dbTarget.GetDocumentByID(noteID)
If sharedFieldDoc.HasItem("$TemplateBuild") Then
Exit Do
End If
Loop
If Not sharedFieldDoc Is Nothing Then
Dim releaseDate As New NotesDateTime(Cstr(currentDoc.GetItemValue("tmpBuildDate")(0)))
Call sharedFieldDoc.ReplaceItemValue("$TemplateBuildName",currentDoc.GetItemValue("tmpBuildName")(0))
Call sharedFieldDoc.ReplaceItemValue("$TemplateBuild", currentDoc.GetItemValue("tmpBuild")(0))
Call sharedFieldDoc.ReplaceItemValue("$TemplateBuild", releaseDate )
Call sharedFieldDoc.Save(True,True)
End If
aber warum, setze ich das dokument am ende auf mark to reponse. das stand so bei dem notesgott aus Paderborn auf der Seite ?
Hmmm also habe nochmal ein bisschen gecodet, aber nichts ändert sich.
For i = i To Ubound(varDBList)
serverPath = Strtoken(varDBList(i),"~",1)
filePath = Strtoken(varDBList(i),"~",2)
Set dbTarget = session.GetDatabase(serverPath,filePath)
newFileName = tmpPrefix + "-" + Replace(dbtarget.FileName,".nsf",".ntf")
targetServer = currentDoc.GetItemValue("targetServer")(0)
targetFilePath = currentDoc.GetItemValue("targetFilePath")(0)
targetFilename = targetFilePath + Cstr(currentDoc.GetItemValue("tmpPrefix")(0)) + newFileName
Set dbTemplate = dbTarget.CreateCopy(targetServer,targetFilename)
Set designDoc = dbTemplate.CreateDocument
designDoc.~$TemplateBuildName = newFileName
designDoc.~$TemplateBuild = tmpBuild
designDoc.~$TemplateBuildDate = tmpDate
Call designDoc.Save(True,False,False)
'Call dbTemplate.Sign(32767,False,signerName,False)
Next
Die Schablonen werden sauber erstellt , landen da wo sie hingehören, aber ich bekomme diesen vermaledeiten Stempel nicht drauf. Das verwirrende für mich ist, dass wenn ich die Schablone mit dem Tool einlese meine Daten richtig drin stehen. Aber warum ??? *heul*
Set dbTarget = session.GetDatabase(serverPath,filePath)
newFileName = tmpPrefix + "-" + Replace(dbtarget.FileName,".nsf",".ntf")
targetServer = currentDoc.GetItemValue("targetServer")(0)
targetFilePath = currentDoc.GetItemValue("targetFilePath")(0)
targetFilename = targetFilePath + Cstr(currentDoc.GetItemValue("tmpPrefix")(0)) + newFileName
Set dbTemplate = dbTarget.CreateCopy(targetServer,targetFilename)
Für Codenatiker :P
serverPath = Strtoken(varDBList(i),"~",1)
filePath = Strtoken(varDBList(i),"~",2)
Set dbTarget = session.GetDatabase(serverPath,filePath)
If Not dbTarget.IsOpen Then
Call dbTarget.Open(serverPath,filePath)
End If
newFileName = tmpPrefix + "-" + Replace(dbtarget.FileName,".nsf",".ntf")
targetServer = currentDoc.GetItemValue("targetServer")(0)
targetFilePath = currentDoc.GetItemValue("targetFilePath")(0)
targetFilename = targetFilePath + newFileName
Set dbTemplate = dbTarget.CreateCopy(targetServer,targetFilename)
So warum kann ich dbTarget nun nicht kopieren.
So habe mal wieder was gefunden,
Dim stream As NotesStream
Set stream = session.CreateStream
stream.WriteText {<database
xmlns='http://www.lotus.com/dxl'
version='6'
templatename='} + Replace(newFileName,".ntf","")+ {'
fromtemplate=''>
</database>}
Dim mp As NotesDXLImporter
Set mp = session.CreateDXLImporter(stream, dbTemplate)
With mp
.ReplaceDbProperties = True
.Process
End With
Das läuft auch soweit, das einzige was ich in der Hilfe nun nicht gefunden habe sind die namen von den anderen Felder die äquivalent zu
$TemplateBuild
$TemplateBuildDate sind
Deswegen meine Frage an Glombi , ich hab ihn in nem Zusammenhang meiner Recherche gefunden.
@Glombi du verweist auf nen Hilfeeintrag den ich zwar finde aber nicht die elemente dich ich benötige, und leider nicht mal das Feld templatename
Edit : Sorry man muss auch die augen auf machen, aber die anderen Felder finde ich dennoch nicht.