![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
I changed the code to do as you suggested. I haven't been able to get to the
display issue because the GetItemFromID throws an exception. I had the assignment of the mailItem's EntryID both before and after the MOVE. I wasn't sure if the EntryID would change after the move. The curious thing is that the EntryID that is being returned from the copied mailItem is the same everytime. I am using the StoreID property of the destination MAPIFolder "_oTechFolder". The exception from GetItemFromID is "Operation Failed"....any advice? private void DisplayIFGMessage(string sMailId) { try { Outlook.MailItem ifgMail = _NameSpace.GetItemFromID(sMailId, _oTechFolder.StoreID) as Outlook.MailItem; ifgMail.Display(true); } catch (Exception exception) { _StreamWriter.WriteLine("EXCEPTION: " + exception.Message); } } private void ConvertToIFGMessage(Outlook.MailItem mail) { string sMailId = null; try { Outlook.MailItem copyMail = mail.Copy() as Outlook.MailItem; copyMail.MessageClass = "IPM.Note.IFGXChange"; copyMail.To = "P-US-Interfaces Tech"; copyMail.Save(); // TRIED HERE AS WELL; placed after move. // sMailId = copyMail.EntryID; copyMail.Move(_oTechFolder); sMailId = copyMail.EntryID; Marshal.ReleaseComObject(copyMail); copyMail = null; } catch (Exception exception) { _StreamWriter.WriteLine("EXCEPTION: " + exception.Message); } _StreamWriter.WriteLine("MAIL ID: " + sMailId); DisplayIFGMessage(sMailId); return; } -- Uncle Vito "Ken Slovak - [MVP - Outlook]" wrote: After you move the email release it and probably call Marshal.Release.ComObject on it. Before that get the EntryID and StoreID of the item (StoreID from item.Parent.EntryID after the move). Then reinstantiate the item from the ID's and open that. If necessary set the message class again of the item before you call Display() on it. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Uncle Vito" wrote in message ... Using VSTO 2005 SE and Outlook 2003 (SP2), I am attempting to take a message that resides in the inbox, copy it to another folder, present it to the user for editing and be done. Upon selection of a context menu entry the following code is executed which simply copies the message, changes the message class, saves the message, moves it to a the destination folder and displays the message for editing. "IFGXChange" is a form published on the destination folder and to be sure I even published it on the inbox. My issue is that when I invoke the Display of that message it is displayed using the default form and not the one which is affiliated with the message class. However, if I close the message and then view the message from the target folder it is displayed using the correct form. Is there something obvious I am missing in order to get the correct form displayed for editing the message. try { Outlook.MailItem copyMail = mail.Copy() as Outlook.MailItem; copyMail.MessageClass = "IPM.Note.IFGXChange"; copyMail.To = "P-US-Interfaces Tech"; copyMail.Save(); copyMail.Move(_oTechFolder); copyMail.Display(true); } catch (Exception exception) -- Uncle Vito |
#2
|
|||
|
|||
![]()
Whether or not the EntryID changes after move/delete depends on the store
provider. In Exchange it does change. In PST files it usually does not. If the EntryID is correct then it should work. I might try a direct cast rather than using As and I might try leaving out the StoreID if the move was to the same store as the original. I'd also run the same code in Outlook VBA as a prototype to verify if it was something else or some .NET thing. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Uncle Vito" wrote in message ... I changed the code to do as you suggested. I haven't been able to get to the display issue because the GetItemFromID throws an exception. I had the assignment of the mailItem's EntryID both before and after the MOVE. I wasn't sure if the EntryID would change after the move. The curious thing is that the EntryID that is being returned from the copied mailItem is the same everytime. I am using the StoreID property of the destination MAPIFolder "_oTechFolder". The exception from GetItemFromID is "Operation Failed"....any advice? private void DisplayIFGMessage(string sMailId) { try { Outlook.MailItem ifgMail = _NameSpace.GetItemFromID(sMailId, _oTechFolder.StoreID) as Outlook.MailItem; ifgMail.Display(true); } catch (Exception exception) { _StreamWriter.WriteLine("EXCEPTION: " + exception.Message); } } private void ConvertToIFGMessage(Outlook.MailItem mail) { string sMailId = null; try { Outlook.MailItem copyMail = mail.Copy() as Outlook.MailItem; copyMail.MessageClass = "IPM.Note.IFGXChange"; copyMail.To = "P-US-Interfaces Tech"; copyMail.Save(); // TRIED HERE AS WELL; placed after move. // sMailId = copyMail.EntryID; copyMail.Move(_oTechFolder); sMailId = copyMail.EntryID; Marshal.ReleaseComObject(copyMail); copyMail = null; } catch (Exception exception) { _StreamWriter.WriteLine("EXCEPTION: " + exception.Message); } _StreamWriter.WriteLine("MAIL ID: " + sMailId); DisplayIFGMessage(sMailId); return; } -- Uncle Vito |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook Form displaying error | Marcus | Outlook - Using Forms | 1 | September 11th 06 06:35 PM |
Using auto correct option in form fields - Outlook 2003 | someday22698 | Outlook - Using Forms | 1 | July 21st 06 12:58 PM |
Value not displaying on Read Page after form is sent? | Rhino | Outlook - Using Forms | 8 | June 21st 06 04:27 PM |
Custom Form not displaying | B-Rock | Outlook - Using Forms | 3 | June 16th 06 02:07 AM |
Converting Outllok97 Form to Outlook 2003 | [email protected] | Outlook - Using Forms | 1 | May 30th 06 09:03 PM |