Outlook doesn't properly start on external activation 
Author Message
 Outlook doesn't properly start on external activation

Hi,

I'm using the following code snippet to send emails from a client-side
app:

    On Error Resume Next
    Dim oo, ns, newmsg, strAdd$
    Set oo = CreateObject("Outlook.Application")
    Set ns = oo.GetNamespace("MAPI")
    If oo = "Outlook" Then
        ns.Logon "", ""
        Set newmsg = oo.CreateItem(0)

        newmsg.Subject = "Subject"
        newmsg.Body = "Body"
        newmsg.Send
        ns.Logoff
    End If
    Set ns = Nothing
    Set oo = Nothing

This works fine as long as Outlook (I'm using 2000, btw) is running.
However, if it's not, it tries to start up (I can see that within the
taskmanager) and then halts. No CPU usage, no dialog popups, no
nothing. The client then, of course, hangs too.

What can be the reason for this behaviour? Any help is greatly
appreciated.

- Ron



Sun, 14 Dec 2003 05:38:42 GMT  
 Outlook doesn't properly start on external activation
Does this Outlook have more than 1 profile? In that case I'd expect a
hang since your login doesn't have a profile, password or a dialog.
Why even use the Logon method at all?

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Co-author of "Programming Microsoft Outlook 2000", Chapters 8-13,
Appendices, Sams


Quote:
> Hi,

> I'm using the following code snippet to send emails from a
client-side
> app:

>     On Error Resume Next
>     Dim oo, ns, newmsg, strAdd$
>     Set oo = CreateObject("Outlook.Application")
>     Set ns = oo.GetNamespace("MAPI")
>     If oo = "Outlook" Then
>         ns.Logon "", ""
>         Set newmsg = oo.CreateItem(0)

>         newmsg.Subject = "Subject"
>         newmsg.Body = "Body"
>         newmsg.Send
>         ns.Logoff
>     End If
>     Set ns = Nothing
>     Set oo = Nothing

> This works fine as long as Outlook (I'm using 2000, btw) is running.
> However, if it's not, it tries to start up (I can see that within
the
> taskmanager) and then halts. No CPU usage, no dialog popups, no
> nothing. The client then, of course, hangs too.

> What can be the reason for this behaviour? Any help is greatly
> appreciated.

> - Ron



Sun, 14 Dec 2003 21:18:51 GMT  
 Outlook doesn't properly start on external activation

Quote:
> Does this Outlook have more than 1 profile?

No, it doesn't.

Quote:
> In that case I'd expect a
> hang since your login doesn't have a profile, password or a dialog.
> Why even use the Logon method at all?

Actually I've already tried this, but omitting the Logon method call
doesn't change anything.

-- Ron



Mon, 15 Dec 2003 04:28:24 GMT  
 Outlook doesn't properly start on external activation
Odd. What happens if you simplify your code and just create an Outlook
application object and just display an Explorer? If you step your code
can you get a valid Outlook object?

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Co-author of "Programming Microsoft Outlook 2000", Chapters 8-13,
Appendices, Sams


Quote:
> > Does this Outlook have more than 1 profile?

> No, it doesn't.

> > In that case I'd expect a
> > hang since your login doesn't have a profile, password or a
dialog.
> > Why even use the Logon method at all?

> Actually I've already tried this, but omitting the Logon method call
> doesn't change anything.

> -- Ron



Mon, 15 Dec 2003 04:33:27 GMT  
 Outlook doesn't properly start on external activation
Try to set ShowDialog parameter to true in the Namespace.Logon() method:
ns.Logon "", "", true

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool


Quote:
> Hi,

> I'm using the following code snippet to send emails from a client-side
> app:

>     On Error Resume Next
>     Dim oo, ns, newmsg, strAdd$
>     Set oo = CreateObject("Outlook.Application")
>     Set ns = oo.GetNamespace("MAPI")
>     If oo = "Outlook" Then
>         ns.Logon "", ""
>         Set newmsg = oo.CreateItem(0)

>         newmsg.Subject = "Subject"
>         newmsg.Body = "Body"
>         newmsg.Send
>         ns.Logoff
>     End If
>     Set ns = Nothing
>     Set oo = Nothing

> This works fine as long as Outlook (I'm using 2000, btw) is running.
> However, if it's not, it tries to start up (I can see that within the
> taskmanager) and then halts. No CPU usage, no dialog popups, no
> nothing. The client then, of course, hangs too.

> What can be the reason for this behaviour? Any help is greatly
> appreciated.

> - Ron



Mon, 15 Dec 2003 07:45:56 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Form doesn't display properly on user's PC

2. Outlook Addin won't allow Outlook to Exit properly

3. Documenter doesn't work properly in A2K

4. Why doesn't Access always add properly?

5. Form control doesn't repond properly?

6. Why doesn't OWA display this properly?

7. Select method doesn't work properly

8. Listbox w/ datasource doesn't sync properly

9. window doesn't paint or scroll properly after recieving WM_GETTEXT

10. Small toolbar look - toolbar control doesn't work properly

11. AllocUnit() function doesn't work properly with NTFS

12. VBScript Eval function doesn't work properly

 

 
Powered by phpBB® Forum Software