Remove Lotus Notes design element inheritance programmatically

一个人想着一个人 提交于 2019-12-01 09:33:05

问题


As part of an effort to create a rudimentary revision control system, I would like to programmatically disable design element level inheritance on a Lotus Notes template. I have so far tried the following:

  • DXL export (ForceNoteFormat=true) + XSLT. This failed with a validation problem in the importer, on fields(!).
  • DXL export (ForceNoteFormat=false) + XSLT. Seems to work, but I'd rather not use a DXL solution for something this general.

An area I would like to explore:

  • Loop over all (design) Notes, remove the $Class item.

Does anybody have a suggestion on how to do this, or another approach that will remove inheritance?


回答1:


The following sub seems to work, it removes the flag from any design element a 7.0.3 client can produce. I got the clues about NotesNoteCollection from Ian's blog entry on the same subject:

Private Sub clearDesignInheritance(db As notesdatabase)
    On Error Goto errorthrower

    Dim nc As NotesNoteCollection
    Set nc = db.CreateNoteCollection(True) ' Select all note types...
    nc.SelectDocuments=False ' ...except data documents.

    Call nc.BuildCollection

    Dim noteid As String
    noteid = nc.GetFirstNoteId

    Dim doc As notesdocument

    Do Until noteid=""
        Set doc = db.GetDocumentByID(noteid)
        If doc.HasItem("$Class") Then
            Call doc.RemoveItem("$Class")
            Call doc.save(False,False,False)
        End If
        noteid = nc.GetNextNoteId(noteid)
    Loop

    Exit Sub
ErrorThrower:
    Error Err, Error & Chr(13) + "Module: " & Cstr( Getthreadinfo(1) ) & ", Line: " & Cstr( Erl )
End Sub


来源:https://stackoverflow.com/questions/1255549/remove-lotus-notes-design-element-inheritance-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!