Results 1 to 14 of 14

Thread: MAPI Questions - 2nd Post

  1. #1

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175
    I want to use MAPI to send a note from VB in the background and I have two questions:

    1) When my code gets to MAPISession1.SignOn and my mail system (Outlook) is not running, a dialog box is displayed by MAPI that asks me to "Choose Profile". How can I avoid that and just use the current profile name? MAPI seems to know what it is since "Microsoft Outlook" is shown in the Profile Name combo box.

    2) How can I automatically delete the email from the user's mail system after it is sent?

  2. #2
    Lively Member
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    101
    i also need answers to these questions.....

  3. #3
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    Does this area help at all?: http://msdn.microsoft.com/library/de...t_you_need.htm

    >>Specifying a Profile During Simple MAPI Logon
    A call to the MAPILogon function produces different results depending on whether you specify a profile name. Normally a profile name is required. If you specify NULL for the lpszProfileName parameter of the MAPILogon function, MAPI first checks for an existing shared session. If possible, the shared session is used. If there is no shared session or if it cannot be used, the call to MAPILogon will fail.

    >>Specifying Passwords with Simple MAPI
    Whether a password is required for you to log on depends on the operating system which is running on the computer. If the operating system integrates messaging system credential checking into the initial system logon, you need not provide a password to the MAPILogon function. If not, a password is required from the user or from a cache location implemented by the client. Microsoft Windows NT and Microsoft Windows 95 do not require passwords for MAPILogon since the user's initial logon to the operating system suffices for both. Clients running with Microsoft Windows for Workgroups are required to provide a password for MAPILogon.

    >>Requesting a Logon User Interface with Simple MAPI
    A client application can log on either by displaying a logon dialog box to provide user interaction or by providing necessary credentials (profile name and password if necessary) programmatically. If you require user interaction, you can use the common dialog box provided by Simple MAPI or create your own. However, it is recommended that you use the standard MAPI dialog boxes whenever possible to promote a consistent look and ease of use.

    The presence or absence of the MAPI_LOGON_UI value in the flFlags parameter of the MAPILogon function controls the logon dialog box display.

    To force the dialog box to be displayed

    Set MAPI_LOGON_UI in the flFlags parameter and set the lpszProfileName and lpszPassword parameters to NULL as follows:

    flFlags |= MAPI_LOGON_UI;
    MAPILogon ((ULONG) hWnd, NULL, NULL, flFlags, 0, &lhSession);

    If you provide a value for lpszProfileName (and lpszPassword if necessary), MAPILogon attempts to establish a session without a user interface. Only if this attempt fails will MAPILogon display the logon dialog box for the user to enter new credentials.
    Last edited by JordanChris; Dec 16th, 2002 at 06:54 AM.

  4. #4
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627
    Try this...

    VB Code:
    1. Set objSession = CreateObject("MAPI.session")
    2.     objSession.Logon "", "", False, False, 0

  5. #5

  6. #6
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    I noticed that, but only after I had added my reply!
    I was thinking "Why is Martin asking these questions? He knows this forum inside out, and will know where to find this information".

    But then I decided to leave my reply anyway, as the second poster might need the answers....

  7. #7

  8. #8
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,383
    no question is ever too old to be answered

  9. #9
    Lively Member
    Join Date
    Nov 2002
    Posts
    78
    forgive me but this sounds like a slightly dodgy thing you are going to do,

    is this part of a system you are building?

  10. #10
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,383
    Originally posted by joey_jones
    forgive me but this sounds like a slightly dodgy thing you are going to do,

    is this part of a system you are building?
    Yeah Martin STOP BUILDING VIRUSES

    I knew I shouldn't have opened that PM from you.. it deleted my whole hard drive

  11. #11
    Lively Member
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    101
    is there a way to get the default/current profile name from the registry?

  12. #12
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    My default profilem on my Windows 2000 system accessing Outlook in Corporate mode - talking to an Exchange Server - is at:

    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\DefaultProfile

  13. #13
    Lively Member
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    101
    how about for other OSs?

  14. #14
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    It should be in one of these:

    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\DefaultProfile

    or

    HKEY_CURRENT_USER\Software\Microsoft\Windows Messaging Subsystem\Profiles\DefaultProfile

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width