Problem with Canceling Outlook application opening under .Net?

Hi,< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

I’m having problems while canceling outlook opening under .NET, using VS.Net2003 & outlook2003.

In my project I added a reference to the ‘Microsoft Outlook 11 Object library’ and created a new outlook application with the following line:

Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();

Once the above line is executed, there is an attempt to open a new outlook application and if outlook was not opened, a windows with the title ‘Microsoft Exchange Server’ is opened asking whether to ‘connect’ or ‘work offline’ or ‘cancel’. If I select ‘cancel’ the same windows reappears all over again, and only after canceling a few times the cancel command is accepted (and the application return to the .Net environment and moves on to next command).

 

Any ideas on how to solve this behavior (I think it is due to the connection between .Net <-> Com object)



Answer this question

Problem with Canceling Outlook application opening under .Net?

  • jstewart335

    Desire behavior: when pressing ‘cancel’, outlook will not open/close and the execution returns to the .Net environment (without the unwanted loop).< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    I’m trying to allow opening a new outlook mail message from my application. As mentioned before, if outlook was closed than the discussed dialog window is opened (as a part of the normal and expected behavior). If the user select ‘cancel’ instead of stopping the attempt to open outlook  and return to the .Net environment, the dialog window keeps appearing for several times -> unwanted behavior which I’m trying to solve.

    (only after several ‘cancel’ requests, the behavior get to the desire point: outlook closes and the control is returned to the .Net environment)

     

    Any solutions to this problem or workarounds suggestions

     

    (I noticed this article http://support.microsoft.com/default.aspx scid=kb;en-us;830519, but it only aimed to help after the instance of the object was created and not during the creation as the situation here)


  • Stefan De Schepper

    Noam,

    I'm sorry you are experiencing an issue with this startup sequence. Although this KB is not an answer to your issue, there is a similarity:
    http://support.microsoft.com/ kbid=824118

    Are you running RPC over HTTP when this occurs If so, this KB may be useful.

    Another idea is to alter the end-user sequence so that they are not presented with the Outlook startup screen in this way. It will depend on the flow of your application, of course. Also, you can set Outlook so that the user does not get to choose whether to go online or not in the Email Account's configuration dialog. It's a common practice.

    I hope this helps.

    It is also helpful to remember that this forum is mainly for issues that directly pertain to the Visual Studio Tools for Office tools per se. So you will be best served by posing this question to a forum or newsgroup wholly dedicated to application-specific issues such as this one. Below, you will find resources you should consult for best results.

    Regards,

    John R. Durant
    http://blogs.msdn.com/johnrdurant

    ------------------------
    VBA and General
    microsoft.public.office.developer.vba
    microsoft.public.office.developer.com.add_ins
    microsoft.public.office.developer.smarttags

    Outlook (consolidated uber list)
    http://blogs.msdn.com/johnrdurant/archive/2005/12/07/vsto_outlook_resourcelist.aspx

    MVP and 3rd Party Sites
    http://www.outlookcode.com
    http://www.officezealot.com



  • Mark Arrow

    Yes, the dialog window which pops up is a part of the normal program startup process. On 'regular' outlook startup everything is o.k.: 'connect', 'offline' and 'cancel' options works as expected. Only when doing so from the .Net environment the 'cancel' option is the problematic as describe above

    Any ideas

    10x
    Noam.


  • AntonS55

    Hi

    The code you are creating is to construct the Outlook Application object in memory the dialog's you are expieriencing are the setup routines and connectivity that would happen if loading Outlook manually.

    Can you confirm that Outlook works by normal execution

    Regards

  • GKim

    To qualify the cancel button is being clicked when you attempt this code but the cancel is having to be clicked a few times

    This may happen in that the COM Object is being instantiated and refreshing an attempt on going down the object model. What are you trying to achieve a clean up on the .NET Instantiation of the Outlook Application object if they do click Cancel Eventually this should return an error in the Object couldn't be created.

    More information would be useful in understanding the desired behaviour

    Regards

  • Problem with Canceling Outlook application opening under .Net?