Remove a profile document
01/03/2007 11:25:59 PM | Cranford, NJ USA
I know this is a BS publication but I need to write. I have been asked by people over and over again "How do I delete a profile in the users mail file?"
Using my handy-dandy F1 keystroke:
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.currentdatabase
'This will delete the Out of Office Profile.
Set doc = db.GetProfileDocument("outofofficeprofile")
Call doc.Remove(True)
'This will delete the Calendar Profile.
Set doc = db.GetProfileDocument("calendarprofile")
Call doc.Remove(True)
End Sub
The reason I am even documenting this is largely due to the Rules used in the Notes/Domino R6.5.1 mail template. Rules actually use the Calendar Profile to store important stuff regarding the Rules. If the rules become corrupt or god forbid the end user deletes the document (R6.5.1 issue, fixed in later releases) the rule will still work! Removing the Calendar Profile will remove rule details!
Another agent I like to use is one that can remove more than one profile document. I know the F1 gods told me that there is only one profile document, but what about those replication conflicts? How can you remove every single copy to the Calendar Profile document. Use the following code to guide you to euphoria:
Sub Initialize
'Remove every copy of the Calendar Profile
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Set db = s.currentdatabase
Set dc = db.GetProfileDocCollection
For x = 1 To dc.count
Set doc = dc.GetNthDocument ( x )
Call doc.Remove(True)
Next
End Sub
Well, I hope this simple documentation can help the administrator out that is banging his/her head against the wall because they cannot determine why the mail file is acting the strange.
Permalink | Domino Development | Comments (0)