Lotus IBM
--
Questions
--
Followers
Top Experts
Attaching files to an new (empty) mail is easy:
NotesRichTextItem rtItem = document.CreateRichTextIte
NotesEmbeddedObject attachment = item.EmbedObject(EMBED_TYP
But if body field already contains text, I can't extract the text
from the NotesRichTextField without the names of the attached files at the end.
That means:
If the body of a mail contains "hello world" and the files "test1.txt" and "test2.txt,
I'm using these lines
NotesItem item = document.GetFirstItem(fiel
fieldText = item.Text;
and get that for "fieldText":
hello world
- test1.txt
- test2.txt
How can I read the clean text content from the RichTextItem?
I'm new to Lotus Notes, so maybe my attachment handling is absolutely wrong.
Here's a piece of my code:
{loads of code}
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
but I still think there's a trick using late bound calls.
Now I managed to get the item as NotesRichTextItem.
The biggest problem left is to change this item.
Read-Only calls are working, but all writing calls fail:
protected internal Object CallRichTextMethod(Object Item, String MethodName, params Object[] Arguments){
Object result = typeof(NotesRichTextItem).
return result;
}
public void AttachFile(NotesDocument document, String attachmentFilePath){
Object obj = document.GetFirstItem("Bod
NotesRichTextItem item = ((NotesRichTextItem)obj);
//this works
String fieldText = (String)CallRichTextMethod
//this doesn't work
Object result = CallRichTextMethod(item, "EmbedObject", (int)EMBED_TYPE.EMBED_ATTA
CallRichTextMethod(item, "AppendText", "hello world");
}
If someone is still interested, here's my solution.
My new rules for automating Notes:
1) Castings between NotesItem and NotesRichTextItem are good only for read access. Write access will cause Interop-Exceptions.
2) Don't mix text items and attachment items.
"Body" is there for the text, for attached files use another NotesRichTextItem. If a document contains files in the Body field, copy them into "Attachments" and delete them from the "Body" field.
3) Get a reference to an existing "Attachments" item by extracting all files, removing the item and adding a new item.
Anyway, I'll give you a few points for reading all that text...






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
NotesSession session = new NotesSession();
session.Initialize("pass")
NotesDatabase db = new NotesDatabase(); // INTEROP ERROR
db = session.GetDatabase("mydom
Lotus IBM
--
Questions
--
Followers
Top Experts
Lotus Software produced the Lotus 1-2-3 spreadsheet program, and later developed Lotus Notes, a groupware and email system. Following its acquisition by IBM, the Notes and Domino client/server collaborative platform were expanded to include functions such as email, calendars, to-do lists, contacts management, teamrooms, discussion forums, file sharing, microblogging, instant messaging, blogs, and user directories. IBM also release SmartSuite, a comprehensive office suite, and followed that with Symphony, unrelated to the Lotus suite of the same name.