A
Andrih
hi,
i have a working code in vb, that imports msg-files (Outlook Messages,
no contacts or tasks) based on the sample from the redemption
homepage.
Now i need to translate this to C#, but it does not work for me.
I use OL 2003 and Win XP.
My Code is:
ApplicationClass oOLApp = ApplicationClass();
NameSpace oNameSpace = oOLApp.GetNamespace("MAPI");
PostItem oItem = (PostItem)oOLApp.CreateItem(OlItemType.olPostItem);
oItem.Save();
string strEntryID = oItem.EntryID;
oItem.Close( OlInspectorClose.olSave );
oItem = null;
oItem = (PostItem)oOLApp.Session.GetItemFromID( strEntryID,
oNameSpace.Folders["Andre"].StoreID );
oItem.MessageClass = "IPM.Note";
Redemption.SafeMailItem oRedemptionItem = new SafeMailItem();
oRedemptionItem.Item = oItem;
oRedemptionItem.Import( _strItemPath, 3 ); //SafeMail Item Class has
no save method in .net, in my VB Sample here i call
RedemptionItem.Save...
This code is working only half. The item is available in Outlook, but
it is shown as a discussion, as long as my application is started.
When i close the application, that has imported the item, it´s
available as a message, as it should be. When i watch the IMessage
Properties before and after i close my application, they are exactly
the same, once it is shown as a discussion, once normal.
What am i doing wrong?
Thanks in advance!
André
i have a working code in vb, that imports msg-files (Outlook Messages,
no contacts or tasks) based on the sample from the redemption
homepage.
Now i need to translate this to C#, but it does not work for me.
I use OL 2003 and Win XP.
My Code is:
ApplicationClass oOLApp = ApplicationClass();
NameSpace oNameSpace = oOLApp.GetNamespace("MAPI");
PostItem oItem = (PostItem)oOLApp.CreateItem(OlItemType.olPostItem);
oItem.Save();
string strEntryID = oItem.EntryID;
oItem.Close( OlInspectorClose.olSave );
oItem = null;
oItem = (PostItem)oOLApp.Session.GetItemFromID( strEntryID,
oNameSpace.Folders["Andre"].StoreID );
oItem.MessageClass = "IPM.Note";
Redemption.SafeMailItem oRedemptionItem = new SafeMailItem();
oRedemptionItem.Item = oItem;
oRedemptionItem.Import( _strItemPath, 3 ); //SafeMail Item Class has
no save method in .net, in my VB Sample here i call
RedemptionItem.Save...
This code is working only half. The item is available in Outlook, but
it is shown as a discussion, as long as my application is started.
When i close the application, that has imported the item, it´s
available as a message, as it should be. When i watch the IMessage
Properties before and after i close my application, they are exactly
the same, once it is shown as a discussion, once normal.
What am i doing wrong?
Thanks in advance!
André