Error: 'Cannot remove NotesDocument when instantiated by NotesUIDocument' sending message from Drafts folder
When you attempt to send a mail message from the Drafts folder, you receive the error:
"Cannot remove NotesDocument when instantiated by NotesUIDocument".
The error occurs only if a user has the Preview Pane open and has the option for "Save mail that you send" set to "Always Prompt" and you choose "No" to the prompt to save the message.
This issue was reported to Quality Engineering and has been fixed in Notes 6.0.5 and 6.5.4.
Excerpt from the Lotus Notes and Domino Release 6.0.5 / 6.5.4 MR fix list (available at http://www.ibm.com/developerworks/lotus):
SPR# HLK5HVJ6B - Error "Cannot remove NotesDocument when instantiated by NotesUIDocument" received, after trying to send a Draft document when the Preview Pane was enabled.
Either respond "Yes" to the prompt to save the message, or close the Preview Pane while working in the Drafts folder. Note: It may be necessary to close and re-open the mail file after closing the Preview Pane in order to avoid the issue.
Additionally, the mail template can be modified to avoid this error. The QueryClose function within the CoreEmailClasses library can be modified to handle this error, as follows:
1. Open the mail template or database from the Designer client.
2. Select Shared Code -> Script Libraries.
3. Open the CoreEmailClasses library.
4. Select the (Declarations) event.
5. Click in the programmer's code pane.
6. Select from the menu Edit -> Find/Replace.
7. Enter in the Find entry: IsFlagSet(MEMO_REMOVE)
8. Click the Find Next button.
9. Locate the following code at line 540 and add the four lines noted:
Set Me.m_notememo = Me.m_session.currentdatabase.getdocumentbyUNID(noteid)
On Error 4241 Resume Next 'Add this line
If Err=4241 Then 'Add this line
Exit Function 'Add this line
End If 'Add this line
For information on a similar issue that was introduced in Notes 6.5.4, refer to the technote titled "Message remains in Drafts folder even though it has been sent" (# 1224019).