IBM Support

How to delete Profile documents manually or using LotusScript

Technote (FAQ)


Question

Resolving problems sometimes requires you to delete profile documents. For example, a corrupt Calendar Profile document in a mail database can cause a Notes workstation crash when creating a calendar entry. Such crashes can be avoided only by deleting the Calendar Profile and recreating it. well. But since Profile documents do not appear in views and folders, how can Profile documents be deleted?

Answer


A distinction can be made between two cases:

1. The Profile document can be accessed for reading and editing directly:

If the Administrator or user is in edit mode after calling up the document, the only actions to perform are to switch into read mode, press the DELETE key and the F9 key. The document will be deleted. This method will not work for profile documents created or edited through a Dialog box, such as the mail template Calendar profile or the Out of Office Profile.

2. The Profile document cannot be accessed directly, or can only be accessed using a Dialog box:

You can use the LotusScript GetProfileDocument method (of the NotesDatabase class) to get a handle to a profile document, and the Remove method (of the NotesDocument class) to delete the profile document. Because calling the GetProfileDocument method creates a Profile document on the fly prior to deleting the document, you should first check to see if the document previously existed. This can be done using the IsNewNote property (of the NotesDocument class). If the property returns True, then the Profile did not exist prior to the GetProfileDocument call and there is no need to delete it.

Beginning with Notes 5, the GetProfileDocCollection method has been added. This allows you to get a collection of Profile documents in a database, independent of the key name used when creating the Profile document(s).

Additionally, if you know the Note ID of a Profile document, then the GetDocumentByID method (of the NotesDatabase class) can also be used to get a handle to a Profile document.

When using the GetProfileDocument method, you need to pass the name of the Profile. If the form the Profile is based on has an alias name, then this should be passed as the name parameter. Profile documents also have an optional key parameter which will also need to be passed if it was originally created using such a key. If the key is unknown, then the GetProfileDocCollection method could be used instead of the GetProfileDocument method.

    • The Calendar Profile is named "CalendarProfile".
    • The Notes 4 Delegation Profile is "DelegationProfile".
    • The Out of Office Profile is "OutOfOfficeProfile".
    • Archive properties are stored in a Profile called "Archive Profile".
    • The iNotes Web Access/Domino Web Access Profile is "iNotesProfile".
    • The Holiday Profile is named "holidayprofile".


The three example agents below can be created by choosing "Create - Agent" from the top menu of a Notes client. In the Create Agent dialog box, specify an agent name. The "type" of agent should be LotusScript. In the agent properties, basics tab, set the Trigger to be "On event" with "Action menu selection" and the Target to be "None". Copy the agent code and place the code in the "Initialize" section of the agent. Paste the code between the lines "Sub Initialize" and "End Sub". Close the agent and choose Save when prompted, or use File - Save from the top menu to save the agent. Once saved, it can be run from the agent list displayed when selecting "Actions" from the top menu of the Notes client.

Example 1: Profile document name known:
    Dim s as new notessession
    Dim db as notesdatabase
    Dim doc as notesdocument
    Set db=s.currentdatabase
    Set doc = db.GetProfileDocument(<Name of desired profile goes here in quotes>)
    Call doc.Remove(True)
    If doc Is Nothing Then
    MsgBox "Profile Document Was Successfully Removed"
    Else
    MsgBox "Profile Document WAS NOT Removed",48
    End if

Example 2: Deleting the Calendar Profile:


    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Set db=session.CurrentDatabase
    Set doc=db.GetProfileDocument("CalendarProfile")
    Call doc.remove(True)
    If doc Is Nothing Then
    MsgBox "Profile Document Was Successfully Removed"
    Else
    MsgBox "Profile Document WAS NOT Removed",48
    End if


Example 3: Accessing Profile document by its Note ID:
    Dim s as new notessession
    dim db as notesdatabase
    dim doc as notesdocument

    Set db = s.currentdatabase
    set doc = db.getdocumentbyid("000021CA")
    If Not doc is Nothing Then Call doc.remove(true)

Where 000021CA is the Note ID of the Calendar profile.

Supporting Information:

From the Online Help:
    GetProfileDocument method

    Retrieves or creates a profile document.

    Defined in

    NotesDatabase

    Syntax

    Set notesDocument = notesDatabase.GetProfileDocument( profilename$ [ , username$] )

    Parameters

    profilename$

    String. The name or an alias of the profile document.

    username

    String. Optional. The user name (key) attached to the profile document.

    Return value

    notesDocument

    The profile document that matches the given name.

    GetProfileDocCollection method

    Given a profile name, returns a collection of profile documents that match the name.

    Note This method is new with Release 5.

    Defined in

    NotesDatabase

    Syntax

    Set notesDocumentCollection = notesDatabase.GetProfileDocCollection( profilename$ )

    Parameters

    profilename$

    String. The name of the profile document.

    Return value

    notesDocumentCollection

    The collection of profile documents that match the given name.

Related information

GetProfileDocument Method Appears to Leak Memory; Error
Error: "Profile Document Enumeration Pool is Full" When

Cross reference information
Segment Product Component Platform Version Edition
Messaging Applications IBM Domino Not Applicable AIX, i5/OS, Linux, Solaris, Windows, z/OS 8.5, 8.0, 7.0, 6.5, 6.0, 5.0 All Editions

Historical Number

169735

Document information

More support for: IBM Notes
Crash/Hang/NSD

Software version: 6.0, 7.0, 8.0, 8.5, 9.0

Operating system(s): Windows, iOS

Software edition: All Editions

Reference #: 1088892

Modified date: 20 September 2010


Translate this page: