SnTT: Unlink individual design elements from a template
By request, here's a SnTT (whoa, it's actually Thursday for once) demonstrating how to programmatically unlink any design elements tied to a specific template (while leaving intact any other element-level inheritance):
Public Function UnlinkElements(dbTarget As NotesDatabase, Byval templateName As String)
Dim linkedElements As NotesNoteCollection
Dim element As NotesDocument
Dim noteId As String
Set linkedElements = dbTarget.CreateNoteCollection(False)
Call linkedElements.SelectAllDesignElements(True)
Let linkedElements.SelectionFormula = {$Class = "} & templateName & {"}
Call linkedElements.BuildCollection()
If (linkedElements.Count > 0) Then
Let noteId = linkedElements.GetFirstNoteId()
While (Len(noteId) > 0)
Set element = dbTarget.GetDocumentByID(noteId)
Call element.RemoveItem("$Class")
Call element.Sign()
Call element.Save(True, True, True)
Let noteId = linkedElements.GetNextNoteId(noteId)
Wend
End If
End Function
Enjoy...
Comments
Posted by Tim Tripcony At 12:19:30 AM On 02/15/2008 | - Website - |
{ Link }
I think it's in my trunk.
Posted by Tim Tripcony At 01:53:23 PM On 02/15/2008 | - Website - |
At the least, check whether the original item is signed, and only update the signature if it was.
Posted by Andre Guirard At 09:44:11 PM On 02/14/2008 | - Website - |
Posted by Chris Whisonant At 01:25:43 PM On 02/15/2008 | - Website - |