![]() |
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
|
|||
|
|||
![]()
hi,
The error i come across while dealing with saving the UserProperties of mails being directed to custom folders is 'The operation cannot be performed because the message has been changed.' The following is my code. // this is called in 'ThisAddIn_Startup' method whenver a new mail is received this.Application.NewMailEx += new Microsoft.Office.Interop.Outlook.ApplicationEvents _11_NewMailExEventHandler(Application_NewMailEx); // the definition for 'Application_NewMailEx' is as follows void Application_NewMailEx(string EntryIDCollection) //autolinking { if (strAutoLink == "ON") { string[] entries = EntryIDCollection.Split(','); for (int c = 0; c entries.Length; c++) { objMailItems = (Outlook.MailItem)objNamesSpace.GetItemFromID(entr ies.GetValue(c).ToString(), objInbox.StoreID); threadMail = new Thread(new ThreadStart(fnNewMailRecv)); threadMail.Start(); } } } //the definition for 'fnNewMailRecv()' is as follows public void fnNewMailRecv() { try { Outlook.MailItem newMail = objMailItems; currentMail = objMailItems; GenModClass objGenMod = new GenModClass(); bool toLink = ThisAddIn.bLinkInCRM; string strSenderName = newMail.SenderName.ToString(); string strUserName = objUser.userName.ToUpper(); Outlook.NameSpace objOUTLOOKNS = this.Application.GetNamespace("MAPI"); Outlook.UserProperty objCRMGoldRecid; Outlook.UserProperty objLinkedToContact; Outlook.UserProperty objLinkedToCompany; Outlook.UserProperty objLinkCheckBox; newMail.Save(); objCRMGoldRecid = newMail.UserProperties.Add("RECID", Outlook.OlUserPropertyType.olText, true, System.Reflection.Missing.Value); objLinkedToContact = newMail.UserProperties.Add("Linked to Contact", Outlook.OlUserPropertyType.olText, true, System.Reflection.Missing.Value); objLinkedToCompany = newMail.UserProperties.Add("Linked to Company", Outlook.OlUserPropertyType.olText, true, System.Reflection.Missing.Value); objLinkCheckBox = newMail.UserProperties.Add("Is Linked", Outlook.OlUserPropertyType.olYesNo, true, System.Reflection.Missing.Value); string strSenderEmailAddress = ""; if (newMail.SenderEmailAddress != null) { strSenderEmailAddress = newMail.SenderEmailAddress.ToString(); string strFrom = strSenderEmailAddress == null ? "" : strSenderEmailAddress; string strTo = newMail.To == null ? "" : newMail.To; string strCC = newMail.CC == null ? "" : newMail.CC; string strBcc = newMail.BCC == null ? "" : newMail.BCC; string strSubject = newMail.Subject == null ? "" : newMail.Subject; if (strSubject.Length 80) strSubject = strSubject.Substring(0, 80).ToString(); string strMsgBody = newMail.HTMLBody == null ? "" : newMail.HTMLBody; string strImp = newMail.Importance.ToString(); string strAccountNo=string.Empty; //gnerating some id string strMailBoxRecID = objGenMod.GenerateRecId().ToString(); string strHasAttachment = (newMail.Attachments.Count 0) ? "Yes" : "No"; //to get a user's account no from my database string sqlQuery = "SELECT dbo.Fun_Email_getLinkAccountNo('" + strSenderEmailAddress + "') AS ACCOUNTNO"; DataSet ds= new DataSet(); try { // calling the webservice ds = crmService.executeCustomQuery(ThisAddIn.SessionID, sqlQuery, objUser.userName, ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } if (ds.Tables.Count 0) { if (ds.Tables[0].Rows.Count 0) { strAccountNo = ds.Tables[0].Rows[0]["ACCOUNTNO"].ToString(); } else strAccountNo = ""; } if (strAccountNo == "") //email address not found in db { objCRMGoldRecid.Value = "UNLINKED"; objLinkedToContact.Value = ""; objLinkedToCompany.Value = ""; objLinkCheckBox.Value = false; } if (strAccountNo != "") { StringBuilder strRFC822 = new StringBuilder(); strRFC822.Append(" "); string strMessageID = newMail.EntryID; strRFC822.Append(newMail.ReceivedTime.ToString("dd d, dd MMM yyyy hh:mm:ss")); //0 strRFC822.Append("^ "); strRFC822.Append(strFrom); //1 strRFC822.Append("^ "); strRFC822.Append(strSubject); //2 strRFC822.Append("^ "); strRFC822.Append(strTo); //3 strRFC822.Append("^ "); strRFC822.Append(strCC);//4 strRFC822.Append("^ "); strRFC822.Append(strHasAttachment);//5 strRFC822.Append("^ "); strRFC822.Append(strMessageID);//6 strRFC822.Append(""); strRFC822.Append("^ "); strRFC822.Append(strMsgBody);//7 strRFC822.Append("^ "); string oldFileName = string.Empty; string extn = string.Empty; string FileName = string.Empty; string emailattachments = ""; strRFC822.Append(emailattachments);//8 strRFC822.Append("^ "); strRFC822.Append(newMail.BodyFormat.ToString());//9 if (strSubject.Length 80) strSubject = strSubject.Substring(0, 80); string strRecdOnDate = newMail.ReceivedTime.ToString(); sqlQuery = "SELECT companyid FROM tblcompanycontact WHERE accountno='" + strAccountNo + "'"; try { //calling webservice ds = crmService.executeCustomQuery(ThisAddIn.SessionID, sqlQuery, objUser.userName.ToUpper(), ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } //create new database record crmEZService.EmailMessage objEmailMessage = new CRMGoldOutlook.crmEZService.EmailMessage(); objEmailMessage.recID = ""; objEmailMessage.Flags = ""; objEmailMessage.lopRecId = ""; objEmailMessage.Folder = strFolderType; objEmailMessage.Folder2 = ""; objEmailMessage.MessageID = strMessageID; objEmailMessage.Attachment = strHasAttachment; objEmailMessage.userId = objUser.userName.ToUpper(); objEmailMessage.MailSize = newMail.Size.ToString(); objEmailMessage.MailDate = DateTime.Parse(strRecdOnDate).ToString("yyyy-MM-dd"); objEmailMessage.MailTime = newMail.ReceivedTime.ToString("HH:mm"); objEmailMessage.MailRef = strSubject; objEmailMessage.RFC822 = strRFC822.ToString(); objEmailMessage.contactID = strAccountNo; objEmailMessage.linkRecId = ""; string MAILBOXRECID = string.Empty; try { //a new id is generated and returned by webservice MAILBOXRECID = crmService.createNewCRMObject(ThisAddIn.SessionID, objEmailMessage, ThisAddIn.objUser.userName.ToUpper(), ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } sqlQuery = "SELECT ISNULL(company,'')as Company, ISNULL(contact,'') as Contact FROM contact1 WHERE accountno='" + strAccountNo + "'"; try { ds = crmService.executeCustomQuery(ThisAddIn.SessionID, sqlQuery, objUser.userName.ToUpper(), ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } // From here onwards, if there are no 'Rules and Alerts' specifed to direct the received mails to custom folder, the values are assigned // perfectly to UserProperties. But when there are rules mentioned to move the received mail to a user created 'Personal folder', then // the following error is thrown 'The operation cannot be performed because the message has been changed.' and the values are not fed // into the user properties. if (ds.Tables.Count 0) { if (ds.Tables[0].Rows.Count 0) { if (objCRMGoldRecid != null) { objCRMGoldRecid.Value = MAILBOXRECID; } objLinkedToContact.Value = ds.Tables[0].Rows[0]["Contact"].ToString(); objLinkedToCompany.Value = ds.Tables[0].Rows[0]["Company"].ToString(); objLinkCheckBox.Value = true; } } newMail.Save(); } } } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); } } Thanks in advance. |
Ads |
#2
|
|||
|
|||
![]()
You're using a new thread to access the Outlook object model, which is
really, really bad. That is not supported and will cause Outlook to crash or hang in most cases. Get rid of that and localize where the problem is coming in your code. You need to show only the relevant code, no one is going to want to wade through all that code to try to find problems. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Problem with UserProperty of mail object" icrosoft.com wrote in message ... hi, The error i come across while dealing with saving the UserProperties of mails being directed to custom folders is 'The operation cannot be performed because the message has been changed.' The following is my code. // this is called in 'ThisAddIn_Startup' method whenver a new mail is received this.Application.NewMailEx += new Microsoft.Office.Interop.Outlook.ApplicationEvents _11_NewMailExEventHandler(Application_NewMailEx); // the definition for 'Application_NewMailEx' is as follows void Application_NewMailEx(string EntryIDCollection) //autolinking { if (strAutoLink == "ON") { string[] entries = EntryIDCollection.Split(','); for (int c = 0; c entries.Length; c++) { objMailItems = (Outlook.MailItem)objNamesSpace.GetItemFromID(entr ies.GetValue(c).ToString(), objInbox.StoreID); threadMail = new Thread(new ThreadStart(fnNewMailRecv)); threadMail.Start(); } } } //the definition for 'fnNewMailRecv()' is as follows public void fnNewMailRecv() { try { Outlook.MailItem newMail = objMailItems; currentMail = objMailItems; GenModClass objGenMod = new GenModClass(); bool toLink = ThisAddIn.bLinkInCRM; string strSenderName = newMail.SenderName.ToString(); string strUserName = objUser.userName.ToUpper(); Outlook.NameSpace objOUTLOOKNS = this.Application.GetNamespace("MAPI"); Outlook.UserProperty objCRMGoldRecid; Outlook.UserProperty objLinkedToContact; Outlook.UserProperty objLinkedToCompany; Outlook.UserProperty objLinkCheckBox; newMail.Save(); objCRMGoldRecid = newMail.UserProperties.Add("RECID", Outlook.OlUserPropertyType.olText, true, System.Reflection.Missing.Value); objLinkedToContact = newMail.UserProperties.Add("Linked to Contact", Outlook.OlUserPropertyType.olText, true, System.Reflection.Missing.Value); objLinkedToCompany = newMail.UserProperties.Add("Linked to Company", Outlook.OlUserPropertyType.olText, true, System.Reflection.Missing.Value); objLinkCheckBox = newMail.UserProperties.Add("Is Linked", Outlook.OlUserPropertyType.olYesNo, true, System.Reflection.Missing.Value); string strSenderEmailAddress = ""; if (newMail.SenderEmailAddress != null) { strSenderEmailAddress = newMail.SenderEmailAddress.ToString(); string strFrom = strSenderEmailAddress == null ? "" : strSenderEmailAddress; string strTo = newMail.To == null ? "" : newMail.To; string strCC = newMail.CC == null ? "" : newMail.CC; string strBcc = newMail.BCC == null ? "" : newMail.BCC; string strSubject = newMail.Subject == null ? "" : newMail.Subject; if (strSubject.Length 80) strSubject = strSubject.Substring(0, 80).ToString(); string strMsgBody = newMail.HTMLBody == null ? "" : newMail.HTMLBody; string strImp = newMail.Importance.ToString(); string strAccountNo=string.Empty; //gnerating some id string strMailBoxRecID = objGenMod.GenerateRecId().ToString(); string strHasAttachment = (newMail.Attachments.Count 0) ? "Yes" : "No"; //to get a user's account no from my database string sqlQuery = "SELECT dbo.Fun_Email_getLinkAccountNo('" + strSenderEmailAddress + "') AS ACCOUNTNO"; DataSet ds= new DataSet(); try { // calling the webservice ds = crmService.executeCustomQuery(ThisAddIn.SessionID, sqlQuery, objUser.userName, ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } if (ds.Tables.Count 0) { if (ds.Tables[0].Rows.Count 0) { strAccountNo = ds.Tables[0].Rows[0]["ACCOUNTNO"].ToString(); } else strAccountNo = ""; } if (strAccountNo == "") //email address not found in db { objCRMGoldRecid.Value = "UNLINKED"; objLinkedToContact.Value = ""; objLinkedToCompany.Value = ""; objLinkCheckBox.Value = false; } if (strAccountNo != "") { StringBuilder strRFC822 = new StringBuilder(); strRFC822.Append(" "); string strMessageID = newMail.EntryID; strRFC822.Append(newMail.ReceivedTime.ToString("dd d, dd MMM yyyy hh:mm:ss")); //0 strRFC822.Append("^ "); strRFC822.Append(strFrom); //1 strRFC822.Append("^ "); strRFC822.Append(strSubject); //2 strRFC822.Append("^ "); strRFC822.Append(strTo); //3 strRFC822.Append("^ "); strRFC822.Append(strCC);//4 strRFC822.Append("^ "); strRFC822.Append(strHasAttachment);//5 strRFC822.Append("^ "); strRFC822.Append(strMessageID);//6 strRFC822.Append(""); strRFC822.Append("^ "); strRFC822.Append(strMsgBody);//7 strRFC822.Append("^ "); string oldFileName = string.Empty; string extn = string.Empty; string FileName = string.Empty; string emailattachments = ""; strRFC822.Append(emailattachments);//8 strRFC822.Append("^ "); strRFC822.Append(newMail.BodyFormat.ToString());//9 if (strSubject.Length 80) strSubject = strSubject.Substring(0, 80); string strRecdOnDate = newMail.ReceivedTime.ToString(); sqlQuery = "SELECT companyid FROM tblcompanycontact WHERE accountno='" + strAccountNo + "'"; try { //calling webservice ds = crmService.executeCustomQuery(ThisAddIn.SessionID, sqlQuery, objUser.userName.ToUpper(), ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } //create new database record crmEZService.EmailMessage objEmailMessage = new CRMGoldOutlook.crmEZService.EmailMessage(); objEmailMessage.recID = ""; objEmailMessage.Flags = ""; objEmailMessage.lopRecId = ""; objEmailMessage.Folder = strFolderType; objEmailMessage.Folder2 = ""; objEmailMessage.MessageID = strMessageID; objEmailMessage.Attachment = strHasAttachment; objEmailMessage.userId = objUser.userName.ToUpper(); objEmailMessage.MailSize = newMail.Size.ToString(); objEmailMessage.MailDate = DateTime.Parse(strRecdOnDate).ToString("yyyy-MM-dd"); objEmailMessage.MailTime = newMail.ReceivedTime.ToString("HH:mm"); objEmailMessage.MailRef = strSubject; objEmailMessage.RFC822 = strRFC822.ToString(); objEmailMessage.contactID = strAccountNo; objEmailMessage.linkRecId = ""; string MAILBOXRECID = string.Empty; try { //a new id is generated and returned by webservice MAILBOXRECID = crmService.createNewCRMObject(ThisAddIn.SessionID, objEmailMessage, ThisAddIn.objUser.userName.ToUpper(), ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } sqlQuery = "SELECT ISNULL(company,'')as Company, ISNULL(contact,'') as Contact FROM contact1 WHERE accountno='" + strAccountNo + "'"; try { ds = crmService.executeCustomQuery(ThisAddIn.SessionID, sqlQuery, objUser.userName.ToUpper(), ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } // From here onwards, if there are no 'Rules and Alerts' specifed to direct the received mails to custom folder, the values are assigned // perfectly to UserProperties. But when there are rules mentioned to move the received mail to a user created 'Personal folder', then // the following error is thrown 'The operation cannot be performed because the message has been changed.' and the values are not fed // into the user properties. if (ds.Tables.Count 0) { if (ds.Tables[0].Rows.Count 0) { if (objCRMGoldRecid != null) { objCRMGoldRecid.Value = MAILBOXRECID; } objLinkedToContact.Value = ds.Tables[0].Rows[0]["Contact"].ToString(); objLinkedToCompany.Value = ds.Tables[0].Rows[0]["Company"].ToString(); objLinkCheckBox.Value = true; } } newMail.Save(); } } } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); } } Thanks in advance. |
#3
|
|||
|
|||
![]()
hi Ken,
Using a new thread to access the Outlook object model was the main problem for me to get the error 'The operation cannot be performed because the message has been changed.' I removed that new thread and called 'fnNewMailRecv()' directly and it worked great without that error. A ton of thanks to you for your wonderful support. Thanks & Regards, Varma. "Ken Slovak - [MVP - Outlook]" wrote: You're using a new thread to access the Outlook object model, which is really, really bad. That is not supported and will cause Outlook to crash or hang in most cases. Get rid of that and localize where the problem is coming in your code. You need to show only the relevant code, no one is going to want to wade through all that code to try to find problems. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Problem with UserProperty of mail object" icrosoft.com wrote in message ... hi, The error i come across while dealing with saving the UserProperties of mails being directed to custom folders is 'The operation cannot be performed because the message has been changed.' The following is my code. // this is called in 'ThisAddIn_Startup' method whenver a new mail is received this.Application.NewMailEx += new Microsoft.Office.Interop.Outlook.ApplicationEvents _11_NewMailExEventHandler(Application_NewMailEx); // the definition for 'Application_NewMailEx' is as follows void Application_NewMailEx(string EntryIDCollection) //autolinking { if (strAutoLink == "ON") { string[] entries = EntryIDCollection.Split(','); for (int c = 0; c entries.Length; c++) { objMailItems = (Outlook.MailItem)objNamesSpace.GetItemFromID(entr ies.GetValue(c).ToString(), objInbox.StoreID); threadMail = new Thread(new ThreadStart(fnNewMailRecv)); threadMail.Start(); } } } //the definition for 'fnNewMailRecv()' is as follows public void fnNewMailRecv() { try { Outlook.MailItem newMail = objMailItems; currentMail = objMailItems; GenModClass objGenMod = new GenModClass(); bool toLink = ThisAddIn.bLinkInCRM; string strSenderName = newMail.SenderName.ToString(); string strUserName = objUser.userName.ToUpper(); Outlook.NameSpace objOUTLOOKNS = this.Application.GetNamespace("MAPI"); Outlook.UserProperty objCRMGoldRecid; Outlook.UserProperty objLinkedToContact; Outlook.UserProperty objLinkedToCompany; Outlook.UserProperty objLinkCheckBox; newMail.Save(); objCRMGoldRecid = newMail.UserProperties.Add("RECID", Outlook.OlUserPropertyType.olText, true, System.Reflection.Missing.Value); objLinkedToContact = newMail.UserProperties.Add("Linked to Contact", Outlook.OlUserPropertyType.olText, true, System.Reflection.Missing.Value); objLinkedToCompany = newMail.UserProperties.Add("Linked to Company", Outlook.OlUserPropertyType.olText, true, System.Reflection.Missing.Value); objLinkCheckBox = newMail.UserProperties.Add("Is Linked", Outlook.OlUserPropertyType.olYesNo, true, System.Reflection.Missing.Value); string strSenderEmailAddress = ""; if (newMail.SenderEmailAddress != null) { strSenderEmailAddress = newMail.SenderEmailAddress.ToString(); string strFrom = strSenderEmailAddress == null ? "" : strSenderEmailAddress; string strTo = newMail.To == null ? "" : newMail.To; string strCC = newMail.CC == null ? "" : newMail.CC; string strBcc = newMail.BCC == null ? "" : newMail.BCC; string strSubject = newMail.Subject == null ? "" : newMail.Subject; if (strSubject.Length 80) strSubject = strSubject.Substring(0, 80).ToString(); string strMsgBody = newMail.HTMLBody == null ? "" : newMail.HTMLBody; string strImp = newMail.Importance.ToString(); string strAccountNo=string.Empty; //gnerating some id string strMailBoxRecID = objGenMod.GenerateRecId().ToString(); string strHasAttachment = (newMail.Attachments.Count 0) ? "Yes" : "No"; //to get a user's account no from my database string sqlQuery = "SELECT dbo.Fun_Email_getLinkAccountNo('" + strSenderEmailAddress + "') AS ACCOUNTNO"; DataSet ds= new DataSet(); try { // calling the webservice ds = crmService.executeCustomQuery(ThisAddIn.SessionID, sqlQuery, objUser.userName, ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } if (ds.Tables.Count 0) { if (ds.Tables[0].Rows.Count 0) { strAccountNo = ds.Tables[0].Rows[0]["ACCOUNTNO"].ToString(); } else strAccountNo = ""; } if (strAccountNo == "") //email address not found in db { objCRMGoldRecid.Value = "UNLINKED"; objLinkedToContact.Value = ""; objLinkedToCompany.Value = ""; objLinkCheckBox.Value = false; } if (strAccountNo != "") { StringBuilder strRFC822 = new StringBuilder(); strRFC822.Append(" "); string strMessageID = newMail.EntryID; strRFC822.Append(newMail.ReceivedTime.ToString("dd d, dd MMM yyyy hh:mm:ss")); //0 strRFC822.Append("^ "); strRFC822.Append(strFrom); //1 strRFC822.Append("^ "); strRFC822.Append(strSubject); //2 strRFC822.Append("^ "); strRFC822.Append(strTo); //3 strRFC822.Append("^ "); strRFC822.Append(strCC);//4 strRFC822.Append("^ "); strRFC822.Append(strHasAttachment);//5 strRFC822.Append("^ "); strRFC822.Append(strMessageID);//6 strRFC822.Append(""); strRFC822.Append("^ "); strRFC822.Append(strMsgBody);//7 strRFC822.Append("^ "); string oldFileName = string.Empty; string extn = string.Empty; string FileName = string.Empty; string emailattachments = ""; strRFC822.Append(emailattachments);//8 strRFC822.Append("^ "); strRFC822.Append(newMail.BodyFormat.ToString());//9 if (strSubject.Length 80) strSubject = strSubject.Substring(0, 80); string strRecdOnDate = newMail.ReceivedTime.ToString(); sqlQuery = "SELECT companyid FROM tblcompanycontact WHERE accountno='" + strAccountNo + "'"; try { //calling webservice ds = crmService.executeCustomQuery(ThisAddIn.SessionID, sqlQuery, objUser.userName.ToUpper(), ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } //create new database record crmEZService.EmailMessage objEmailMessage = new CRMGoldOutlook.crmEZService.EmailMessage(); objEmailMessage.recID = ""; objEmailMessage.Flags = ""; objEmailMessage.lopRecId = ""; objEmailMessage.Folder = strFolderType; objEmailMessage.Folder2 = ""; objEmailMessage.MessageID = strMessageID; objEmailMessage.Attachment = strHasAttachment; objEmailMessage.userId = objUser.userName.ToUpper(); objEmailMessage.MailSize = newMail.Size.ToString(); objEmailMessage.MailDate = DateTime.Parse(strRecdOnDate).ToString("yyyy-MM-dd"); objEmailMessage.MailTime = newMail.ReceivedTime.ToString("HH:mm"); objEmailMessage.MailRef = strSubject; objEmailMessage.RFC822 = strRFC822.ToString(); objEmailMessage.contactID = strAccountNo; objEmailMessage.linkRecId = ""; string MAILBOXRECID = string.Empty; try { //a new id is generated and returned by webservice MAILBOXRECID = crmService.createNewCRMObject(ThisAddIn.SessionID, objEmailMessage, ThisAddIn.objUser.userName.ToUpper(), ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } sqlQuery = "SELECT ISNULL(company,'')as Company, ISNULL(contact,'') as Contact FROM contact1 WHERE accountno='" + strAccountNo + "'"; try { ds = crmService.executeCustomQuery(ThisAddIn.SessionID, sqlQuery, objUser.userName.ToUpper(), ThisAddIn.IPAddress); } catch (Exception Ex) { MessageBox.Show(Ex.Message); fnWriteErrorLog(Ex); return; } // From here onwards, if there are no 'Rules and Alerts' specifed to direct the received mails to custom folder, the values are assigned // perfectly to UserProperties. But when there are rules mentioned to move the received mail to a user created 'Personal folder', then |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with Object Reference for MailItem | alexcraig | Outlook and VBA | 3 | January 6th 08 10:08 PM |
OUTLOOK 2002 CALENDAR PROBLEM: object not valid | USDUTCH | Outlook - Calandaring | 1 | July 14th 07 04:09 PM |
attachments, dealing with | Dave Horne | Outlook - General Queries | 6 | March 15th 07 12:25 PM |
Automating dealing with junk mail and spam | Silent Ken | Outlook and VBA | 6 | January 12th 07 12:44 AM |
AdvancedSearch on Userproperty 'Metro' of Custom contact form 'MyContact'. | [email protected] | Outlook - General Queries | 0 | April 28th 06 03:47 PM |