The following is a lotus script code that will help you add an attachment to a rich text field
Function addAttachmentToRichTextField(doc As NotesDocument,rtField As String,filePath As String) _
As Boolean
'***********************************************************
'@Purpose : add a file denoted by the filepath to a richtext field
'@Author : Karthikeyan A
'@Param : doc As NotesDocument - the document which contains the rich text field
'@Param : rtField As String - the name of the rich text field in which the attachment is to added to
'@Param : filePath As String - the path of the file that needs to be attached
'@Note : The doc specified here must not be a new one.
' That is doc.IsNewNote must be 0
'***********************************************************
'mark the flow of control moving into the current function
addAttachmentToRichTextField=False
'declare variables and objects necessary for further manipulation
Dim rtItem As NotesRichTextItem
'handle errors in case of abrupt termination
On Error Goto errHandler
'set the handle of the richtext item associated with the rtfield name
Set rtItem=doc.GetFirstItem(rtField)
'embedd the file as an attachment to the richtext field
Call rtitem.EmbedObject ( EMBED_ATTACHMENT, "", filePath)
'save the document
Call doc.Save( True, False )
'mark the flow of control moving into the current function
addAttachmentToRichTextField=True
Exit Function
'inform the user regarding the error that results in abrupt termination
errHandler:
Print "Error ***" & Error & "*** occured on line ***" & Cstr(Erl) & "*** with error number ***" _
& Cstr(Err) & "*** in Method ""addAttachmentToRichTextField"" "
Msgbox "Error ***" & Error & "*** occured on line ***" & Cstr(Erl) & "*** with error number ***" _
& Cstr(Err) & "*** in Method ""addAttachmentToRichTextField"" "
Exit Function
End Function
Hope this helps :)
Is this possible using jquery?
ReplyDeleteYes you can call an agent with this lotusscript and pin the url to $.ajax
ReplyDeleteAttachment goes into document but not associated to a field. Do my preferences need some adjustment?
ReplyDeletePost your code. Let me see. Make sure the richtext field is really richtext field. A simple mistake that many would do. Cheers
Deletehii karthik
ReplyDeleteCan you create an agent to download the attachments from all the documents and again i want to restore all attachments to the documents in the database.
Can you help me in this
This comment has been removed by the author.
ReplyDeleteyou need to use eo:NotesEmbeddedObject= doc.getAttachments("attachmentName") and you have to go for eo.extractTo(fileLocation)
ReplyDeleteDownloading attachments wont remove them from the document when u use this method.
We can discuss if you need a consultant to build lotus applications
HI
ReplyDeletei have 2 document..document A is where i input the data and document B compute the data from document A by clicking button. but why i cannot retrieve the rich text data from doc A? can u show me the code on how to compute rich text from other document and display it in different doc....tq
atirafoad@gmail.com
try doc.renderToRichtextItem. Probably that would help
Delete