![]() |
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 have created a VSTO add-in that will take the selected message and
will attempt to execute forward or replyall depending upon the menu command selected. The whole purpose of this exercise is to take a standard email, convert to a new message class and update the user properties (special fields) of the message. The selected message is copied, its message class is changed and then it is moved to a temporary personal folder (ConvertToIFGMessage). Toward the later part of the processing the temporary folder is scanned for all messages and presented to the user for editing (SendIFGMessage). My question and problem concerns the fact that both the ReplyAll and Forward are returning a NULL reference. Can you offer any clues? Even better is there a way to trace exactly what is happening? private void ConvertToIFGMessage(Outlook.MailItem mail) { try { Outlook.MailItem copyMail = mail.Copy() as Outlook.MailItem; copyMail.MessageClass = "IPM.Note.IFGXChange"; copyMail.Save(); copyMail.Move(_oIFGDrafts); Marshal.ReleaseComObject(copyMail); copyMail = null; } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); _ifgTechListener.Flush(); } return; } private void SendIFGMessage(_eSendType eSendType) { try { foreach (object obj in _oIFGDrafts.Items) { if (obj is Outlook.MailItem) { Outlook.MailItem ifgDraftMail = obj as Outlook.MailItem; Outlook.MailItem ifgMail = null; if(eSendType == _eSendType.eSTForward) { ifgMail = ((Outlook._MailItem)ifgDraftMail).Forward(); ifgMail.CC = ifgDraftMail.SenderEmailAddress + ";" + ifgDraftMail.To.ToString() + ";" + ifgDraftMail.CC.ToString(); ifgMail.Body = "Message Forwarded to IFGTech For Review" + ifgMail.Body.ToString(); } else { ifgMail = ((Outlook._MailItem)ifgDraftMail).ReplyAll(); ifgMail.CC = ifgDraftMail.CC.ToString() + ";" + "P-US-Interfaces Tech"; Outlook.UserProperty uDateTimeProp = ifgMail.UserProperties.Add("DateResponded", Outlook.OlUserPropertyType.olDateTime, _Missing, _Missing); uDateTimeProp.Value = System.DateTime.Now; Outlook.UserProperty uRespondedProp = ifgMail.UserProperties.Add("Responded", Outlook.OlUserPropertyType.olYesNo, _Missing, _Missing); uRespondedProp.Value = true; } ifgMail.Display(true); ifgDraftMail.Delete(); } } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); _ifgTechListener.Flush(); } } #region VSTO generated code /// summary /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// /summary private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); } #endregion } } |
Ads |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
forward | Sam | Outlook - General Queries | 4 | January 29th 07 07:22 PM |
How to setup a rule to forward rule in Outlook (xp or 2003) to forward emails from a certain domain when app isnt running? | KingCronos | Outlook - General Queries | 7 | November 15th 06 11:22 AM |
forward inline | morilla_s | Outlook Express | 1 | September 5th 06 02:58 PM |
how to disable "forward" and "replyall" on an email programitcaly | Ravikanth | Outlook - Using Forms | 1 | August 10th 06 04:44 PM |
forward as icalendar | kirsty | Outlook - Calandaring | 1 | March 20th 06 02:30 PM |