none
ItemSend event and long running process RRS feed

  • Question

  • Hi,

    We have developed an addin in Outlook that communicates with External systems.
    When we call the Send Mail event there is certain processing that happens before the e-mail message is supposed to send (we are using the Meeting Item).

    The problem is that our process is taking too long, and it seems like the Meeting Item is not waiting for our process to complete before sending the message out, so the message that is being sent out is incomplete. A user property is supposed to be written during this pre-processing, but never gets there, and the recipient of the Meeting doesn't get that information.

    See code below

        private void olApplication_ItemSend(object item, ref bool cancel)
        {
          if (item is Outlook.MeetingItem)
          {
            Outlook.MeetingItem mi = (Outlook.MeetingItem)item;
            bool isPrivate = true;
            IEnumerator enumerator = mi.UserProperties.GetEnumerator();
            string InspectorId = "";
            while (enumerator.MoveNext())
            {
              Outlook.UserProperty property = (Outlook.UserProperty)enumerator.Current;
              if (property.Name == "InspectorId")
              {
                InspectorId = property.Value.ToString();
                isPrivate = false;
                break;
              }
            }
    
            if (!isPrivate)
            {
              cancel = true;
              int InspectorIdx = inspectors.InspectorIndex(new Guid(InspectorId));
              InspectorWrapper wrapper = inspectors[InspectorIdx];
              if (wrapper.RequiredPropertyChanged)
              {
                wrapper.IsSending = true;
                if (!wrapper.SaveAppointment())
                {
                  cancel = true;
                }
              }
              wrapper.RequiredPropertyChanged = false;
            }
          }
        }
    
    

    Any ideas what can be done?

    Thanks.

    Monday, May 2, 2011 9:53 PM

Answers

  • I fixed the problem is a different way, by saving the Inspector Id value to the appointment form in CRM and then retrieving using InspectorId instead of meeting ID.
    • Marked as answer by Aric Levin Wednesday, May 4, 2011 1:07 AM
    Wednesday, May 4, 2011 1:07 AM

All replies

  • I fixed the problem is a different way, by saving the Inspector Id value to the appointment form in CRM and then retrieving using InspectorId instead of meeting ID.
    • Marked as answer by Aric Levin Wednesday, May 4, 2011 1:07 AM
    Wednesday, May 4, 2011 1:07 AM
  • Hi Brite Global,

    I am glad to hear that you have resolved your problem yourself and thank you for sharing the workaround with us. You are welcome.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Wednesday, May 4, 2011 2:42 AM