Solved

MAPI automatic logon

Posted on 1998-01-08
7
667 Views
Last Modified: 2013-11-13
How do I get my app to logon to a profile on startup. At present it pops up a dialog asking for Profile Name.
If I specify a profile (other than 'Microsoft Outlook') error 32003 makes it's presence known.
0
Comment
Question by:pokrakam
7 Comments
 
LVL 8

Expert Comment

by:mrmick
ID: 1449906
Someone may be able to help you if you povided details.  You've got the code in front of you and you couldn't figure it out.   How do you expect someone else to help you without having a clue what the code looks like, what version of VB you're running, etc...
0
 

Author Comment

by:pokrakam
ID: 1449907
Sorry, lack of detail.
NT4, VB5 SP3. The mail clients are (on various machines): Outlook, Windows Messaging (NT), Exchange.
I'm using VB's MAPI session control.
The problem is to use mail without running Exchange etc. in background, and without the app asking for a profile name upon startup.

0
 

Expert Comment

by:jrmno1
ID: 1449908
Throw away the control....Use the COM object directly...I have automatic SQL DB Status checking programs that only use 15 lines of code to complete the EMail process without user intervention.... I pickup the subroutine from MS doc on thier web site.....and uesd it without much modfication...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:mrmick
ID: 1449909
jrmno1, lack of detail

pokrakam, if you want code to send email with the winsock control only, I can send you code which I wrote to accomplish this.  email me at mick@owen.wa.com if this sounds like the solution to your problem.
0
 

Author Comment

by:pokrakam
ID: 1449910
Thanx all, I will keep that in mind.
However, at present I'm sitting with a huge amount of code I inherited a while ago. The app is an EDI message processing / distribution server - i.e. works with a lot of email/X400.
Unfortunately, until my planned rewrite in about a year's time, I'm stuck with MAPI Session controls.

0
 
LVL 4

Accepted Solution

by:
rantanen earned 250 total points
ID: 1449911
This might be something what you already know, but i make it an answer anyway, because it works in my Win95-based peer-to-peer network just fine. Can be any profile defined, no dialogs shown.

A procedure to login, send a message and logout could be e.g.

Private Sub btnSend_Click()
    MAPIMessages1.MsgIndex = -1
' Following is a name from the address book/list in use
    MAPIMessages1.RecipDisplayName = "Lea Rantanen"
    MAPIMessages1.MsgSubject = "Reminder at " & Now()
    MAPIMessages1.MsgNoteText = txtNote.Text

    MAPISession1.NewSession = True
    MAPISession1.LogonUI = False
' Following is actually a profile name, not a username
    MAPISession1.UserName = "Lasse Rantanen"
    MAPISession1.Password = ""

    MAPISession1.SignOn
    MAPIMessages1.SessionID = MAPISession1.SessionID
    MAPIMessages1.Send
    MAPISession1.SignOff
End Sub

I have Windows Messaging (Exchange client) version 4.0 as mail service provider. I can't guarantee this works with other clients (Outlook etc.), because I can't test with them.
0
 

Author Comment

by:pokrakam
ID: 1449912
Yup, was something I already knew, but it did prompt me to try something which did work:
I initially just tried entering the profile name in the Control properties on the form. The idea was to get it working, then I'll write the code to retrieve profile name from registry, assign it to the control etc. The catch is, if I fill it in the properties box, it don't work (except for 'Microsoft Outlook'), but if I assign it in the code, it does.   Bug??? Hmmmm...... (I do feel rather stupid nevertheless)
Thanx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
base64 decode encode 12 121
VBA Shell can't Find Word document 11 76
Not needed 13 94
Powershell Script need assistance to make some changes 4 62
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This video teaches viewers about errors in exception handling.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now