none
Troubleshooting COM (common object model) interface issues with Outlook RRS feed

  • Question

  • Hi

    Our software uses COM to interface with locally installed Microsoft Outlook to manage calender entries, mails and task from within our software.

    In rare cases we meet situations where Outlooks seems to become unresponsive while interfacing with our software.

    But we could yet figure out why and under what circumstances this can happen neither can we provoke it.

    Are there any monitoring or troubleshooting/looging tools to record such interface actions?

    I have to say I am a SE and not the developer myself but have him for at hand for further assistance with the issue.

    Thanks for any input in advnance.

    Regards,

    Benno

    Friday, March 11, 2016 3:21 PM

Answers

  • I completely agree with Edward. Redemption is a third-party utility (not a part of Outlook or Office). So, I'd recommend contacting the Redemption developer directly.

    The issue can be caused by Redemption, not Outlook.

    • Marked as answer by coolpilot Thursday, March 24, 2016 1:04 PM
    Monday, March 21, 2016 6:02 AM

All replies

  • Hi Benno,

    >> Our software uses COM to interface with locally installed Microsoft Outlook to manage calender entries, mails and task from within our software

    I am not sure what you are developing. Could you share us a simple code which you are using or which com you used?

    It would be helpful if you could share us more information about your project.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, March 14, 2016 5:35 AM
  • Hi. Thanks. Acting just on behalf of our development department and not being a programmer myself I have forwared your question to answer to the actual programmer.
    Monday, March 14, 2016 10:57 AM
  • Hi

    Our software uses COM to interface with locally installed Microsoft Outlook to manage calender entries, mails and task from within our software.

    In rare cases we meet situations where Outlooks seems to become unresponsive while interfacing with our software.

    But we could yet figure out why and under what circumstances this can happen neither can we provoke it.

    Are there any monitoring or troubleshooting/looging tools to record such interface actions?


    The Outlook object model (OOM) runs on Outlook's main UI thread.  Any long-running interaction with the OOM has the potential to make Outlook unresponsive.  For example, a long running task that is triggered from within an OOM event handler would cause Outlook to be unresponsive.  Also, in the case of a COM add-in, the add-in should not call the OOM from a background thread.  If the software is interfacing with Outlook as an out-of-process COM server it is also possible that Outlook built-in security is blocking on certain actions attempted by the software.  Since Outlook is not showing a UI in this case everything would seem to be hung. See Security Behavior of the Outlook Object Model


    • Edited by RLWA32 Monday, March 14, 2016 1:15 PM added link
    Monday, March 14, 2016 11:17 AM
  • Hi Edward

    Thanks for your help.

    The programmer has compiled a C# project with its basic functions in VS2012 that I could upload somewhere. Would that be possible?

    Best regards,

    Benno

    Monday, March 14, 2016 1:34 PM
  • Here you can download the sample VS2012 project in C#:

    https://www.infogate.ch/htm/quickdownloads.htm?id=BB_INFOGATE-1977_MSOutlookExample_20160314_1438.zip

    Thanks a lot for your help.

    Regards,

    Benno




    • Edited by coolpilot Monday, March 14, 2016 2:18 PM
    Monday, March 14, 2016 2:16 PM
  • Hello,

    The first thing I'd suggest to start with is to release all underlying COM objects instantly. Use System.Runtime.InteropServices.Marshal.ReleaseComObject to release an Outlook object when you have finished using it. This is particularly important if your add-in attempts to enumerate more than 256 Outlook items in a collection that is stored on a Microsoft Exchange Server. If you do not release these objects in a timely manner, you can reach the limit imposed by Exchange on the maximum number of items opened at any one time. Then set a variable to Nothing in Visual Basic (null in C#) to release the reference to the object. Read more about that in the Systematically Releasing Objects article.

    When you work with recurring appointment items, you should release any prior references, obtain new references to the recurring appointment item before you access or modify the item, and release these references as soon as you are finished and have saved the changes. This practice applies to the recurring AppointmentItem object, and anyException or RecurrencePattern object. To release a reference in Visual Basic for Applications (VBA) or Visual Basic, set that existing object to Nothing. In C#, explicitly release the memory for that object.

    Note that even after you release your reference and attempt to obtain a new reference, if there is still an active reference, held by another add-in or Outlook, to one of the above objects, your new reference will still point to an out-of-date copy of the object. Therefore, it is important that you release your references as soon as you are finished with the recurring appointment.

    Office applications use the single threaded apartment model which doesn't support multithreading. Latest Outlook versions may fire exceptions if they detect use of the OOM from background threads. If you need to use background threads in the solution you may consider using a low-level code - Extended MAPI. Or just any third-party wrapper around that API (such as Redemption).

    Monday, March 14, 2016 3:36 PM
  • I am again translating the answer on behalf of the actual programmer: 1. We release all objects after use

    if(appItem!=null) { //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(appItem); } catch { }"); try { Marshal.ReleaseComObject(appItem); } catch(Exception ex) { } } if(taskItem!=null) { //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(taskItem); } catch { }"); try { Marshal.ReleaseComObject(taskItem); } catch(Exception ex) { } } if(mailItem!=null) { //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(mailItem); } catch { }"); try { Marshal.ReleaseComObject(mailItem); } catch(Exception ex) { } } if(itemButton0!=null) { //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(itemButton0); } catch { }"); try { Marshal.ReleaseComObject(itemButton0); } catch(Exception ex) { } } if(itemButton1!=null) { //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(itemButton1); } catch { }"); try { Marshal.ReleaseComObject(itemButton1); } catch(Exception ex) { } } if(itemButton2!=null) { //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(itemButton2); } catch { }"); try { Marshal.ReleaseComObject(itemButton2); } catch(Exception ex) { } } if(itemButton3!=null) { //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(itemButton3); } catch { }"); try { Marshal.ReleaseComObject(itemButton3); } catch(Exception ex) { } } if(itemButton4!=null) { //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(itemButton4); } catch { }"); try { Marshal.ReleaseComObject(itemButton4); } catch(Exception ex) { } } //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(item); } catch { }"); try { Marshal.ReleaseComObject(item); } catch(Exception ex) { } if(itemCommandBar!=null) { //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(itemCommandBar); } catch { }"); try { Marshal.ReleaseComObject(itemCommandBar); } catch(Exception ex) { } } //LoggerIG.Debug(this,"try { Marshal.ReleaseComObject(itemInspector); } catch { }"); try { Marshal.ReleaseComObject(itemInspector); } catch(Exception ex) { } appItem = null; taskItem = null; mailItem = null; item = null; itemButton0 = null; itemButton1 = null; itemButton2 = null; itemButton3 = null; itemButton4 = null; itemCommandBar = null; itemInspector = null; 2. We do not use 'recurring appointments 3. We do use 'redemption'. But the relevant code in the sample project has been commented as it would otherwise have been to complex as an example. For example: RedemptionIG rig = new RedemptionIG(pApp); pService.PAttachments = rig.GetAttachments(); pService.PBody = rig.GetBody(); pService.PHTMLBody = rig.GetHTMLBody(); pService.PRTFBody = rig.GetRTFBody(); pService.POutlookOwner = rig.GetOrganizer(); if(pWriteFile) { rig.SaveAs(pService.PFilePath); } Or RedemptionIG rid = new RedemptionIG(ti); rid.SetAttachments(pItem); //outlook default nehmen ti.ReminderSet = false; ti.Display(pModal);

    Unfortunately we see nothing in here that we could apply to remedy the situation. Again, thanks for any futher help or input in advance. Best regards, Benno




    • Edited by coolpilot Tuesday, March 15, 2016 8:22 AM
    Tuesday, March 15, 2016 8:20 AM
  • Have you tried using a VS profiler? What method exactly in the code takes too much time?
    Tuesday, March 15, 2016 1:21 PM
  • Hi

    It is not that we usually see a problem.

    We are looking for ways to troubleshoot in certain customer environments where in very rare cases they experience situations where Outlooks seems to 'hang' when interfacing with our software. But even there we cannot provoke the situations, the come and go, i,.e. there are times where these users can work normally. It seems user dependent. Could the culprit be Outlook add-ons these customer use? Are there ways we could get around these add-ons for debugging?

    Thanks.

    Best regards,

    Benno

    Tuesday, March 15, 2016 2:02 PM
  • Hi Benno,

    >> Are there ways we could get around these add-ons for debugging?

    You could start outlook in safe mode, which launches outlook without add-ins loaded.
    1.Start Outlook in safe mode. To do this:
    For Windows XP, click Start, and then click Run.
    For Windows Vista or Windows 7, click Start
    For Windows 8 or Windows 8.1, hold the Windows key and press X, then choose Run in the popup menu.

    2.Type Outlook /safe in the Run dialog box.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, March 17, 2016 6:13 AM
  • Hi Benno,

    Have your issue been resolved? If you have, it would be appreciated if you could share us your solution. If not, please feel free to let us know your current situation.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, March 18, 2016 6:40 AM
  • Hi Edward

    Sorry for the delay but I have been busy otherwise.

    No, the issue has not been resolved and I was to address this to Microsoft as a last resort since our programmers have it already given a great thought but do not know how to proceed any further.

    As mentioned earlier, in the vast majority of installations we do not have any issues but there are client environments where it happens and we do not know to troubleshoot those properly.

    Best regards,

    Benno

    Friday, March 18, 2016 10:49 AM
  • Hi Edward

    Thanks but I may not have expressed myself properly: we wonder if there are ways to get around any add-ins in a an Outlook instance in C# not when manually starting outlook; I new about the /safe switch. But how can we make sure there are no add-ins loaded when interfacing or loading outlook from within the program code.

    Thanks a lot.

    Best regards,

    Benno

    Friday, March 18, 2016 10:52 AM
  • Hello Benno,

    I'd recommend adding log statements to the add-in's code where you can gather all the required environment information such as number of add-ins installed (name, descriptions and etc.). So, you can reproduce the issue in the house.

    Is the certificate revocation enabled on a problematic machine?

    Disable CRL Checking Machine-Wide Control Panel -> Internet Options -> Advanced -> Under security, uncheck the Check for publisher's certificate revocation option.

    Take a look at the A .NET Framework 2.0 managed application that has an Authenticode signature takes longer than usual to start article for more information.
    Friday, March 18, 2016 11:09 AM
  • Hi Eugene

    Thanks. Ours is not a COM add-in but but interfacing with Outlook via the API wrapper Redemtion (see previous post). But we suspect that customer's loaded add-ins could have a negative effect.

    Friday, March 18, 2016 12:30 PM
  • Hi coolpilot,

    >> we suspect that customer's loaded add-ins could have a negative effect.

    I think you could disable all add-ins, or you could create a new VM with clean outlook to check whetehr this issue still exist.

    >> Ours is not a COM add-in but but interfacing with Outlook via the API wrapper Redemtion (see previous post).
    It seems your issue is related with Redemition, do you mean tool in the link below? If so, since this is not Microsoft product, I would suggest you contact developer of Outlook Redemption for help. They are more familiar with it. Or, I would suggest you try to achieve your function with Outlook Object Model to check whether this issue still exist.

    http://www.dimastr.com/redemption/home.htm

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Monday, March 21, 2016 3:26 AM
  • I completely agree with Edward. Redemption is a third-party utility (not a part of Outlook or Office). So, I'd recommend contacting the Redemption developer directly.

    The issue can be caused by Redemption, not Outlook.

    • Marked as answer by coolpilot Thursday, March 24, 2016 1:04 PM
    Monday, March 21, 2016 6:02 AM
  • Hi

    As our solution works in 99% of all cases we will not investiate into the matter any further; the issue must be caused by a specific customer situation.

    Thanks.

    Regards,

    Benno

    Thursday, March 24, 2016 1:07 PM