Mail attachment question

NEVERMIND! I gave the DB to a friend to check out and they found it! Get this…They first unchecked the db property, “Display Images After Loading” then added a carriage return after the text and just prior to the attachment in the look-up document. This appears to have corrected the issue.

I hope this helps someone else in the future. :slight_smile:

I have recently been attempting to copy text and any attachments in a rich text field on a “look up” document to an email. I had it working once, but now my generated email has a simple down arrow in a box rather than the attachment icon and throws the ever useful “Note Item Not Found”. Has anyone ever seen something like this?

I’ll see if I can add pictures. The code is below. I’ve tried everything I can think of. I ensured the fields were truly rich text and not RTLite, I even removed the fields and recreated them. Recreated the document and reattached the desired files. Tried CopyItem, everything keeps giving me the funny outline box with down arrow in it along with the error for each file attached. The odd thing is that attachment can actually be read but it sure looks ugly in the email.

Any ideas are most appreciated.

Sub RequestForms

'**********************************************************************************

’ This routine is called from the following buttons:

’ “Apply for Access” and “Request Change of Access Forms”

’ This code will display a list of possible forms which may be requested.

’ When selected, an email will be sent to the requestor and the manager,

’ if different from the requestor containing the selected forms and the

’ necessary instructions provided with the forms on the lookup documents.

'**********************************************************************************

Dim ws As New NotesUIWorkspace

Dim uidocCurrent As NotesUIDocument

Dim Session As New NotesSession

Dim dbCurrent As NotesDatabase

Dim docCurrent As NotesDocument

Dim docTemp As NotesDocument

Dim docMemo As NotesDocument

Dim docSecForm As NotesDocument

Dim docConfig As NotesDocument

Dim item As NotesItem

Dim itemRTTarget As NotesRichTextItem

Dim itemRTSource As NotesRichTextItem

Dim arvarAccessOptions As Variant

Dim itemValue As Variant

Dim arvarCCList As Variant

Dim i%

Dim ReturnCode%

Dim flag%

Dim ReturnMsg$

Dim EmpName$

Dim Temp$

Dim ChangeInfo$

Dim UserName$

Dim varTemp As Variant

Dim nnUserName As NotesName

Set uidocCurrent = ws.CurrentDocument

Set docCurrent = uidocCurrent.document

Set dbCurrent = docCurrent.ParentDatabase

’ Get the User Name

Set nnUserName = session.CreateName( session.UserName)

UserName$ = nnUserName.Abbreviated

’ Do some validations

If Not ( ValidateNotesID%( uidocCurrent)) Then

Exit Sub

'<=============

End If

’ Locate the Database Config Document

Set docConfig = GetConfigDoc( dbCurrent, “Database Configuration”, ReturnMsg$)

If ReturnMsg$ <> “” Then

Messagebox ReturnMsg$, MB_OK + MB_ICONEXCLAMATION, “Error Locating Database Configuration Document”

Exit Sub

'<=========

End If

Set docTemp = dbCurrent.CreateDocument

flag% = ws.Dialogbox( “dlgAccessOptions”, True, True, False, False, False, False, “Access Options”, docTemp, True, False, False)

If flag% Then

arvarAccessOptions = docTemp.GetItemValue(“AccessOptions”)

If arvarAccessOptions( 0) = “” Then

Messagebox “No access options were selected.” & Chr(13)_

& Chr(13)_

& “This process has been halted.”_

, MB_OK + MB_ICONEXCLAMATION, “No Access Options Selected”

Else

’ Create the eMail to be mailed

Set docMemo = dbCurrent.CreateDocument

Set item = docMemo.ReplaceItemValue( “Form”, “Memo”)

’ Set the SendTo to be the person sending

Set item = New NotesItem( docMemo, “SendTo”, session.UserName)

item.IsSummary = True

itemValue = Evaluate( “@Name( [ABBREVIATE]; SendTo)”, docMemo)

Set item = docMemo.ReplaceItemValue( “SendTo”, ItemValue)

’ Add the Manager into the CopyTo field

Set item = New NotesItem( docMemo, “CopyTo”, docCurrent.MgrNotesID( 0))

item.IsSummary = True

itemValue = Evaluate( “@Name( [ABBREVIATE]; CopyTo)”, docMemo)

Set item = docMemo.ReplaceItemValue( “CopyTo”, ItemValue)

’ If the user who clicked the button is the manager, clear the CopyTo Field

If docMemo.SendTo( 0) = docMemo.CopyTo( 0) Then

Set item = docMemo.ReplaceItemValue( “CopyTo”, “”)

End If

’ Get the Employee’s Name so we can re-use it

EmpName$ = docCurrent.FirstName( 0) & " " & docCurrent.LastName( 0)

’ Set the Subject and Body

Set item = docMemo.ReplaceItemValue( “Subject”, docConfig.GetItemValue( “FormRequestSubject”)( 0) & " " & EmpName$)

Set itemRTTarget = docMemo.CreateRichTextItem( “Body”)

Set itemRTSource = docConfig.GetFirstItem( “FormRequestNotification”)

Call itemRTTarget.AppendRTItem( itemRTSource)

ChangeInfo$ = "The following access forms were requested by " & UserName$ & " on " & Now( ) & Chr( 13)

’ For each of the selected forms, collect the form document and the text which should go in the body of the memo

For i% = Lbound( arvarAccessOptions) To Ubound( arvarAccessOptions)

ChangeInfo$ = ChangeInfo$ & " " & arvarAccessOptions( i%) & Chr( 13)

Set docSecForm = GetDoc( dbCurrent, “vwhSecForms”, arvarAccessOptions( i%), ReturnCode%, ReturnMsg$)

Set itemRTSource = docSecForm.GetFirstItem( “Body”)

Call itemRTTarget.AddNewLine( 2, True)

Call itemRTTarget.AppendRTItem( itemRTSource)

Next i%

Call docMemo.ComputeWithForm( False, False)

Call docMemo.Send( False )

Messagebox "An eMail containing the requested form(s) has been sent to " & docMemo.SendTo( 0) & “.” & Chr( 13) _

& Chr( 13) _

& “Please ensure this document is saved and that replication occurs so the eMail is delivered.”, _

MB_OK + MB_ICONINFORMATION, “eMail Sent”

’ set IsActive to “Yes”

docCurrent.IsActive = “Yes”

’ Update Log

varTemp = docCurrent.GetItemValue( “AccessRequestHistory”)( 0)

varTemp = varTemp & ChangeInfo$

Set item = docCurrent.ReplaceItemValue( “AccessRequestHistory”, varTemp)

End If

Else ’ pressed cancel

’ NoOp

End If ’ flag%

Call uidocCurrent.RefreshHideFormulas

Call uidocCurrent.refresh

End Sub ’ RequestForms