Autor Thema: HowTo designReplace per LotusScript  (Gelesen 2783 mal)

Offline platzebo

  • Junior Mitglied
  • **
  • Beiträge: 58
HowTo designReplace per LotusScript
« am: 20.01.12 - 08:08:44 »
falls mal jemand eine Schablone per Knopfdruck wechseln möchte...  ;D

Declare Sub W32_OSPathNetConstruct Lib "nnotes.dll" Alias "OSPathNetConstruct" (Byval portName As String, Byval ServerName As String, Byval FileName As String, Byval retPathName As String)

Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" ( Byval szDBName As String, dwDBHandle As Long) As Integer

Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" ( Byval dwDBHandle As Long) As Integer

Declare Function W32_DesignReplace Lib "nnotes.dll" Alias "DesignReplace" (Byval ht As Long, Byval hDB As Long, Byval dw1 As Long, Byval dw2 As Long, Byval dw3 As Long, Byval dw4 As Long) As Integer


Function ReplaceDesign(TemplDB As NotesDatabase, TargetDB As NotesDatabase) As Integer
   
        on error goto errHandle

   Dim PathName As String * 256
   Dim TargetPathName As String * 256
   
   Dim htemplate As Long
   Dim htarget As Long
   
   Dim DBDocPropTempl As NotesDocument
   Dim DBDocPropTarget As NotesDocument

   ReplaceDesign = false

   Call W32_OSPathNetConstruct("", TemplDB.Server, TemplDB.FilePath, PathName)
   Call W32_OSPathNetConstruct("",TargetDB.Server, TargetDB.FilePath,TargetPathName)
   
   Call W32_NSFDbOpen(PathName, htemplate)
   If htemplate=0 Then Exit Function
   Call W32_NSFDbOpen(TargetPathName, htarget)
   If htarget=0 Then Exit Function
   
   Call W32_DesignReplace(htemplate, htarget, 1, 1, 0, 0)
   
   Call W32_NSFDbClose(htemplate)
   Call W32_NSFDbClose(htarget)
   
   Set DBDocPropTempl = TemplDB.GetDocumentByID("FFFF0010")
   Set DBDocPropTarget = TargetDB.GetDocumentByID("FFFF0010")
   Call DBDocPropTempl.CopyAllItems(DBDocPropTarget)
   Call DBDocPropTarget.Save(True, False)

        ReplaceDesign = true
   exit function

errHandle:
        msgbox cstr(err) + " : " + error + " in Line " + cstr(erl)
        exit function
End Function
« Letzte Änderung: 20.01.12 - 08:36:37 von platzebo »
Ein König Mann ist, das Kindsein nicht vergisst

Offline pram

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.170
  • Geschlecht: Männlich
    • Foconis Object Framework
Re: HowTo designReplace per LotusScript
« Antwort #1 am: 21.01.12 - 13:52:39 »
Achtung,  bei copyallitems unbedingt replace=true als 2. Parameter setzen,  sonst hat man die items dpppelt.
Gruß Roland
Roland Praml

IBM Certified Application Developer - Lotus Notes and Domino 8
Ich verwende das Foconis Object Framework

Offline platzebo

  • Junior Mitglied
  • **
  • Beiträge: 58
Re: HowTo designReplace per LotusScript
« Antwort #2 am: 23.01.12 - 06:48:28 »
Danke für den Tip und einen guten Wochenstart :)
Ein König Mann ist, das Kindsein nicht vergisst

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz