I need to migrate a large number of emails from Lotus Notes to a Outlook MSG format.
I need to ensure that the MSG's represent the emails in their original Lotus Notes format, including date sent, sent by, etc, and all attachments.
I have created LotusScript code to extract the email data and attachments from the Lotus Notes databases and store in a SQL database with attachments on a file store. I now need to work on code to read this data and create the Outlook messages. I have the scaffolding of a C# .Net application in place, but am struggling with being able to set read-only properties of the Outlook message, such as SentOn.
How do I/Can I set the read-only properties of the Outlook MailItem?
Are you importing the messages to Outlook first?
If you only need to create standalone MSG files, you can use Redemption (I am its author) and its RDOSession.CreateMessageFromMsgFile method -it returns an instance of the RDOMail object. You can set various RDOMail properties and call RDOMail.Save.
Related
I'm using Outlook 2019 add-in. I need to get mail item when it is moved to Sent items folder after the email is sent. I often send SMIME encrypted or signed and encrypted emails.
When I send encrypted or signed and encrypted email to most of the recipients then I can read mail item properties (using Outlook Object Model) without problem. MessageClass in such case is IPM.Note.
However I noticed that if I send encrypted or signed and encrypted email to myself (the same email in From and To) then I can't read almost all properties. I can read some like Class, DownloadState, IsConflict, MarkForDownload, Permission, Sent, Subject, Submitted, Unred or MessageClass which in this case is IPM.Note.SMIME but for others I get exception: "Your Digital ID name cannot be found by the underlying security system."
My cert is valid and seems to be ok as encrypted emails can be sent to me from another account.
Is it Outlook bug or I can do something to make Outlook read those properties using Outlook Object Model?
I also tried to use Extended MAPI and this time I could successfully read all properties. However I prefer to use OOM and I'm also curious why I can't read all properties using OOM only in specific case.
In my application, i send mails to managers from program automatically. Normally it works good, but when i use program on another computer, it sends mail automatically but file type is not PDF. File type is File and name of pdf is =utf-8BQU5HT1JBIEhBTEkgQS7Fni4gR8OcTkzD. I also checked source codes. But I couldn't understand what is wrong with that. Any idea what to do?
Try to fill the ContentDisposition, example is here:
Sending email with attachments from C#, attachments arrive as Part 1.2 in Thunderbird
Maybe, in the code you can change the MediaTypeNames.Application.Octet to MediaTypeNames.Application.Pdf
I hope, this helps!
I am trying to develop an outlook add-in in VS 2010. It's purpose is to scan email body and attachment content for some key words and if any such words are found, email sending should be blocked.
I am able to read email body and subject and to the validation but I am not understanding how to read an attachment content (txt file) while composing the mail.
attachment.GetTemporaryPath() is not giving the attachment path. I guess this works only for mails in inbox.
One way I found was saving the attachment to a temp folder and reading it (attachment.saveAs()).
Is this the only way to read attachment content while composing a mail ?
Possible Duplicate : C# Outlook 2007 - How do I access attachment contents directly from my addin?
But as suggested in there, I cant use Redemption. Is there any other way?
Yes, saving the attachment data to a temporary file and reading it s the only way. In theory, you can use Attachment.PropertyAccessor.GetProperty to read the PR_ATTACH_DATA_BIN property, but you will run into problems for the large (> 64kB) files.
You can also use Extended MAPI to open the attachment data as IStream (IAttach::OpenProperty(PR_ATTACH_DATA_BIN, IID_IStream)), but it is only accessible through C++ or Delphi. You can use Redemption (any language - I am its author) that wraps Extended MAPI and exposes AsArray and AsText properties on both RDOAttachment and the Attachment object exposed by the Safe*Item objects.
I am writing a COM add-in for Outlook using C#. If a meeting was saved and invitations were not sent, Outlook puts a message at the top of the form saying the invitations have not been sent. How do I determine programmatically that invitations have not been sent for a meeting?
I tried examining each Recipient and checking the MeetingResponseStatus. I would expect it to be OlResponseNone if the invitation has not been sent but OlResponseNotResponded if the invitations have been sent but no responses have been received. However, I always get OlResponseNone for recipients that either haven't been sent an invitation or that have but have not yet reponded. I therefore can't tell apart a meeting where invitations haven't been sent from one where they have been sent but no one has responded.
I've done most of my testing in Outlook 2007, but I believe the same holds true for 2003 and 2010, all of which I need to support.
I found a partial answer in this post. I need to read the DASL property "http://schemas.microsoft.com/mapi/id/{00020329-0000-0000-C000-000000000046}/80BE0102". In Outlook 2007 and leter, you can do this with a PropertyAccessor as follows:
appointment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/id/{00020329-0000-0000-C000-000000000046}/80BE0102");
However, I need to also support Outlook 2003, and the PropertyAccessor property was added in Outlook 2007. I was therefore able to use Redemption's RDOMail object with the following code (error handling omitted).
var _session = New RDOSession();
_session.Logon();
var _message = _session.GetMessageFromID(appointment.EntryID, ((Outlook.MAPIFolder)appointment.Parent).StoreID);
return (bool)_message.Fields["http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/8229000B"];
Marshal.ReleaseComObject(_message);
_session.Logoff();
Marshal.ReleaseComObject(_session);
I am following this guide and havent got very far
http://www.c-sharpcorner.com/UploadFile/casperboekhoudt/SendingEmailsThroughOutlook12052005000124AM/SendingEmailsThroughOutlook.aspx
I am getting stuck here
Now that we have the MAPI namespace,
we can log on using using:
.Logon(object Profile,
object Password, object ShowDialog,
object NewSession)
Profile: This is a string value that
indicates what MAPI profile to use for
logging on. Set this to null if using
the currently logged on user, or set
to an empty string ("") if you wish to
use the default Outlook Profile.
All i want to do from my programme is take the email address i already have in a variable and open up a new outlook email window with that email address in the too section.
Thanks very much.
This document on CodeProject shows how to open the default mail client.
http://www.codeproject.com/KB/dotnet/Default_mail_client.aspx
Check this list for common Outlook tasks.
I'm using the send attachments
It was quite easy to set up Outlook email capabilities to send reports in one of my apps following the one titled "HOW TO: Use the Microsoft Outlook Object Library to send a message that has attachments by using Visual C# .NET".
Good Luck