2

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Anders Lindahl
  • 41,582
  • 9
  • 89
  • 93
  • 1
    ironically, I'd like to "programatically disable" Lotus Notes! – Mitch Wheat Aug 10 '09 at 15:36
  • @Mitch: That I know how to do with DXL... :-) – Anders Lindahl Aug 10 '09 at 16:19
  • It's problems like this, and [this other one](http://stackoverflow.com/q/2248663/241142), that make me want to throw away Notes completely and exclusively use Ruby (and its gems), a much saner and better designed system for sharing code. Notes' system for sharing code is copy and paste. It's too bad: Notes has many flashes of brilliance, but in the end it is death by 10,000 paper cuts. – iconoclast Apr 12 '13 at 14:07

1 Answers1

4

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
Anders Lindahl
  • 41,582
  • 9
  • 89
  • 93