Outlook

  • Thread starter Thread starter T. Pleatman
  • Start date Start date
T

T. Pleatman

I am trying to use the Interop assemblies with Outlook. If Outlook is
waiting for a login when I call something like

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

it will hang. No error or exception, just hang. And I can't seem to tell if
Outlook is in that waiting for login condition because there is only 1
process for Outlook.

Is there a way around this? Thanks!

Tom
 
Tom,
What do you mean by "waiting for a login"?

I'm asking some fellow Outlook MVPs to see if they have any ideas on your
problem.

Thanks
Jay
 
Hi Jay -

There are a couple of places where Outlook has what I referred to as a
"login". One is where if there is a choice of profiles, Outlook will
wait until a profile is selected. The second is if Outlook is connected
to an Exchange server, and Outlook is waiting for perhaps a
name/password or the connection.

While there are actually 2 windows on the screen = 1 for Outlook, 1 for
the profile selection or Exchange login, there is only 1 process. And
trying to get an application object at these times hangs without an
exception.

I'd appreciate any thoughts on handling these - Thanks!

Tom
 
Tom,
Are you saying that once the user answers the dialog that your C# app still
does not come back?

Do you have the same problem if you use VB6 or VBA from Word? (trying to
identify a problem with Outlook, COM, or .NET Interop).

Is this with PIA (Primary Interop Assembly) or the IA created by VS.NET?

Which version of Outlook?


If the app returns once you answer the dialog I would say this is "by
design" as all the information required for Outlook to login is not being
supplied, so you need to supply it. However if you answer the dialog & it
still hangs then there is a problem. Normally in the former I provide all
the information to log in, unfortunately I do not have a complete sample of
that handy right now.

Hope this helps
Jay
 
Hi Jay -

To answer your questions as best I can:

a) I think there 2 different behaviors, though I should probably nail
this down for you. The first is YES, the program will continue on fine
if you login soon. By soon, I think I've seen a econd behavior where if
you don't logon for a few minutes, then the program will continue on
without an Outlook app object.

b) I'm not sure what Word might do as I don't have that on a server nor
does it require a login. I use Excel in the same program without any
issues. Would you kindly explain this a bit more?

c) I added a reference under COM entitled "Microsoft Outlook 11.0 Object
Library. It is listed under references in my project as simply
"Outlook".

d) I am using Office Professional 2003, with VS .NET development system
and WinXP OS.


If it's "by design", is there a way at least for me to recognize that is
what is happening - or be able to kick out of the hanging? Ideally, I
would just present a window telling the user that they must logon before
my program will continue - and have retry/cancel selections.

- Tom
 
Thomas,
you don't logon for a few minutes, then the program will continue on
without an Outlook app object.
Do you mean your .NET program? I would expect this as the COM called timed
out, I would actually expect an exception of some sort in your .NET
application...
b) I'm not sure what Word might do as I don't have that on a server nor
..NET is not COM, Word is COM. I want to identify if its an interop problem
between .NET & COM or if COM only has the same "problem". If Word to Outlook
has the same problem then the problem is NOT .NET, if Word to Outlook does
not have the same problem, then there is a good chance that it is .NET.
c) I added a reference under COM entitled "Microsoft Outlook 11.0 Object
Library. It is listed under references in my project as simply
"Outlook".
But did you install the optional Primary Interop Assembly from the
Outlook/Office setup disks? Does your project have an assembly called
"interop.outlook.dll" or something to that effect in its bin folder?
If it's "by design", is there a way at least for me to recognize that is
See your a), if your app is continuing without an application object, then
it happened... Otherwise I don't really see that you can...
would just present a window telling the user that they must logon before
If they are not seeing the Outlook login prompt, how are they going to
notice your prompt?? ;-) Realizing that the Outlook prompt can be "hidden"
behind other windows...

Hope this helps
Jay
 
Hi Jay -
Do you mean your .NET program?
Yes, my program; and there's no exception thrown.
..NET is not COM, Word is COM.....
I'm not sure what you would want me to try here. Again, Excel apparently
works fine - but then again there is no profile selection or login since
it's not a MAPI app.

BTW - If I setup mail with the setting of "always use this profile" so
that Outlook does not need to ask the user anything, all works fine.
It's this process of Outlook waiting for something before it is really
operational that is the kicker. If I could grab the object and then wait
for the Outlook's MAPI signon event, it would be great, but I can't grab
the object at this profile selection or server logon point.
But did you install the optional....
Yes, I have the Microsoft.Office.Interop.Outlook.dll assembly.
If they are not seeing the Outlook login prompt...
It's not a question of whether they see it - if they are looking, they
will. The idea is to let them know that I can't proceed without their
doing something about Outlook. I can add beeps or big flashing windows
or .... to grab their attention, which Outlook does not do.

Thanks for your help!!

Tom





Tap
 
Back
Top