Note that there are some explanatory texts on larger screens.

plurals
  1. POLotus Domino: How can I add a department's signature to an email sent through C# using Domino.dll
    primarykey
    data
    text
    <p>I'm writing a program where I can send mails (using domino.dll) from three different department mailboxes (each using its own mail server and nsf-file). All three department mailboxes have a predefined mail signature such as</p> <p>Regards Department X</p> <p>Since those can change anytime I don't want to hardcode the signature in my program but extract them from the mailbox/nsf-file instead and append it to the mail body (or something else if there are better approaches).</p> <p>I've been looking around all day without finding a solution to this problem, so my question is: How is this achieved?</p> <p>So far my code is similar to this:</p> <pre><code>public Boolean sendNotesMail(String messageText) { //Create new notes session NotesSession _notesSession = new NotesSession(); //Initialize Notes Database to null; NotesDatabase _notesDataBase = null; //Initialize Notes Document to null; NotesDocument _notesDocument = null; string mailServer = @"Path/DDB"; string mailFile = @"Deparmentmail\number.nsf"; //required for send, since its byRef and not byVal, gets set later. object oItemValue = null; // Start the connection to Notes. Otherwise log the error and return false try { //Initialize Notes Session _notesSession.Initialize(""); } catch { //Log } // Set database from the mailServer and mailFile _notesDataBase = _notesSession.GetDatabase(mailServer, mailFile, false); //If the database is not already open then open it. if (!_notesDataBase.IsOpen) { _notesDataBase.Open(); } //Create the notes document _notesDocument = _notesDataBase.CreateDocument(); //Set document type _notesDocument.ReplaceItemValue("Form", "Memo"); //sent notes memo fields (To and Subject) _notesDocument.ReplaceItemValue("SendTo", emailAddress); _notesDocument.ReplaceItemValue("Subject", subjectText); // Needed in order to send from a departmental mailbox _notesDocument.ReplaceItemValue("Principal", _notesDataBase.Title); //Set the body of the email. This allows you to use the appendtext NotesRichTextItem _richTextItem = _notesDocument.CreateRichTextItem("Body"); // Insert the text to the body _richTextItem.AppendText(messageText); try { _notesDocument.Send(false, ref oItemValue); } </code></pre> <p>}</p> <p>EDIT: Thanks to Richard Schwartz my solution is:</p> <pre><code>object signature = _notesDataBase.GetProfileDocument("calendarprofile", "").GetItemValue("Signature"); String[] stringArray = ((IEnumerable)signature).Cast&lt;object&gt;().Select(x =&gt; x.ToString()).ToArray(); _richTextItem.AppendText(stringArray[0]); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload