Mapi logon User domain and pass

   How would i set a mapi control to logon using the user name, domain, and password? My issue is that i supplied the user name and passowrd, but it is not logging in. When i try to check the mail it tells me the login failed. The login sub that i have created, creates no errors, and even assigns a session id. I dont know if this is really the issue or not.
LVL 2
damion69Asked:
Who is Participating?
 
SpideyModConnect With a Mentor Commented:
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0
 
vbDocCommented:
Hi,
Using MAPI is a two step process. 1. Open a session. 2. Do mail stuff using the Session ID.

As long as you get a session Id then you are ready to go.

Don't forget to close the session when done.

HTH,
vbDoc
0
 
gencrossCommented:
Here is an example of the mapi session and message object:

    With frmEMail.mapSession
        ' Set DownLoadMail to False to prevent immediate download.
        .DownLoadMail = False
        .LogonUI = True ' Use the underlying email system's logon UI.
        .SignOn ' Signon method.
        .NewSession = True
        'blnNewSession = .NewSession
        frmEMail.mapMessage.SessionID = .SessionID ' You must set this before continuing.
    End With


    With frmEMail.mapMessage
        .Compose
        .RecipIndex = 0
        .RecipDisplayName = "[SMTP:" & sEMailAddress & "]"
        '.RecipType = mapToList
       
        If sCCEMail <> "" Then
            .RecipType = mapCcList
            .RecipIndex = 1
            .RecipDisplayName = "[SMTP:" & sCCEMail & "]"
        End If
       
        .MsgSubject = sSubject
       
        strFile = Dir(PDFInvoicePath & "\*.*")
       
        'Get the count of file attachments
        Do While strFile <> ""
            iPosition = iPosition + 1
            strFile = Dir
        Loop
       
        .MsgNoteText = Space(iPosition + 1) & sBody '& "         "              'this seems to be required
               
        .Send
     end with
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
gencrossCommented:
I hope this makes sense.
0
 
Richie_SimonettiIT OperationsCommented:
hearing...
0
 
damion69Author Commented:
That is how i have my code. When i logon, i am not using the LogonUI = True, i have it set to false, and it seems to logon. I get a session id which is a number, but every time i try to read or even compose mail, i get an error that the logon information is incorrect. When i do use the interface, it allows me to enter a domain name with the logon. Then it works. The issue with not using the logon, is if there are probles with the box it is going on, and we have to reboot, i need the program to automaticly start.
0
 
MCummings111400Commented:
What do you have the UserName property of the MAPISession control set to? And Does the currently logged on user have access to the mailbox you are trying to open?
0
 
damion69Author Commented:
The username is the profile name. the currently logged user is me, so yes i have access to my mailbox.
0
 
damion69Author Commented:
Anyone going to comment, Can this be done?? If not please delete and refund my points
0
 
MCummings111400Commented:
In the profile you are using, what services are you configured for?
0
 
damion69Author Commented:
microsoft exchange. When i log into my mail, i go through outlook, and it requires me to enter username password, and domain. Then it logs me in. I need to know how to simulate this through pure mapi and not using the outlook objects.
0
 
MCummings111400Commented:
Ok, I think that is your problem. Your profile is configured for user supplied authentication (Username , Password) if you set the UI to false, it can't ask you for that information, and hence your errors. I'm going to take a look to see if there is a way around this. I'll try to have an answer back by tommorrow.
0
 
damion69Author Commented:
I am loking for a way to have the program login automaticly. I do not want the user to have to type anything in. So through code somehow i need to pass user, pass, and domain.
0
 
MCummings111400Commented:
Is it an IT requirement that the user supply their username and password agin to log onto the mail server? You can set the profile to use the current logged on user to authenticate and bypass that second dialog for logging into the mail server.
0
 
damion69Author Commented:
This application is not going to be ran by users. This is a Server/Client excel report scheduler. the server must be able to log into the mail without user input. So i store that in an ini file, encrypted using rc4 encryption. So the information will be entered for this on setup. so now i can pass the user and pass without a problem. I just cant get it to work due to the requirement of enterine a domain, like i would have to do to enter my mail. i enter the user pass and domain as would the server also. once the server logs on to the mail, then users are allowed to connect to it.
0
 
MCummings111400Commented:
Ok, done my reseaching. As far as I can tell, in order to get the Session to authenticate without user input, you MUST allow the currently logged on user access to the mailbox specified in the profile and set the LOGONUI = false. This will allow the application to connect to the exchnage server using the credentials of whomever is logged into the console (or the user specified in the service properties if you are running the app as a service)

If you are forcing users to enter their DOMAIN/USERNAME and PASSWORD then you must use LogonUI = True. Hovever since you want no user intervention, you will have to allow the logged on user access to the mailbox.

If you can supply me with some more details about your Exchange configuration I might be able to give you a more explicit example.
0
 
damion69Author Commented:
I do not control how exchange is set up. I have my box, and even after i login to the network, i still am required to enter user,pass, and domain to access my mail.
0
 
damion69Author Commented:
How do i close this question?
0
 
damion69Author Commented:
The answer needed was not given. I am still reserching to figure out how to resolve this issue.
0
 
GathanasCommented:
Try having your app map a drive to a share with the un/dom. or open an IPC pipe to the PDC or BDC with the un/pw.  I hear that once you authenticate that way you can pass that token to the exch. server and login to the other mailbox.  Alternatively, you can use NT scheduler and have it login automatically with the un/pw and run your app.  you would then be able to open a session and run your app.

Good Luck!
George
0
 
damion69Author Commented:
This still does not work. I have to supply the Domain also. I need to know how to enter the domain with the user name and pass.
0
 
fokkerlitCommented:
I have the same problem. I cant get the domain name entered into the logon function. Everything works when I have the logon window pop up, but otherwise i get errors, if you found a resolution to this i would love to know it.
0
 
damion69Author Commented:
I am still trying to find a resolution to this. I dont really think there is one. But then how does outlook do it. I have the same issue trying to use the outlook item.
0
 
fokkerlitCommented:
Someone mentioned using the sendkeys function, but it doesnt seem to work, when the code runs it pauses and doesnt like anything else run. With the Senkeys method you could just have it automatically go through that dialogue box. Right now I'm trying to find a function that will log me into the domain somehow. Hopefully that will work.
0
 
fokkerlitCommented:
Someone mentioned using the sendkeys function, but it doesnt seem to work, when the code runs it pauses and doesnt like anything else run. With the Senkeys method you could just have it automatically go through that dialogue box. Right now I'm trying to find a function that will log me into the domain somehow. Hopefully that will work.
0
 
fokkerlitCommented:
Someone mentioned using the sendkeys function, but it doesnt seem to work, when the code runs it pauses and doesnt like anything else run. With the Senkeys method you could just have it automatically go through that dialogue box. Right now I'm trying to find a function that will log me into the domain somehow. Hopefully that will work.
0
 
fokkerlitCommented:
Someone mentioned using the sendkeys function, but it doesnt seem to work, when the code runs it pauses and doesnt like anything else run. With the Senkeys method you could just have it automatically go through that dialogue box. Right now I'm trying to find a function that will log me into the domain somehow. Hopefully that will work.
0
 
fokkerlitCommented:
Someone mentioned using the sendkeys function, but it doesnt seem to work, when the code runs it pauses and doesnt like anything else run. With the Senkeys method you could just have it automatically go through that dialogue box. Right now I'm trying to find a function that will log me into the domain somehow. Hopefully that will work.
0
 
fokkerlitCommented:
Someone mentioned using the sendkeys function, but it doesnt seem to work, when the code runs it pauses and doesnt like anything else run. With the Senkeys method you could just have it automatically go through that dialogue box. Right now I'm trying to find a function that will log me into the domain somehow. Hopefully that will work.
0
 
fokkerlitCommented:
Someone mentioned using the sendkeys function, but it doesnt seem to work, when the code runs it pauses and doesnt like anything else run. With the Senkeys method you could just have it automatically go through that dialogue box. Right now I'm trying to find a function that will log me into the domain somehow. Hopefully that will work.
0
 
fokkerlitCommented:
Someone mentioned using the sendkeys function, but it doesnt seem to work, when the code runs it pauses and doesnt like anything else run. With the Senkeys method you could just have it automatically go through that dialogue box. Right now I'm trying to find a function that will log me into the domain somehow. Hopefully that will work.
0
 
fokkerlitCommented:
Someone mentioned using the sendkeys function, but it doesnt seem to work, when the code runs it pauses and doesnt like anything else run. With the Senkeys method you could just have it automatically go through that dialogue box. Right now I'm trying to find a function that will log me into the domain somehow. Hopefully that will work.
0
 
fokkerlitCommented:
Someone mentioned using the sendkeys function, but it doesnt seem to work, when the code runs it pauses and doesnt like anything else run. With the Senkeys method you could just have it automatically go through that dialogue box. Right now I'm trying to find a function that will log me into the domain somehow. Hopefully that will work.
0
 
MCummings111400Commented:
The answer is this;

You can NOT use a MAPI/Outlook profile that has the Logon Network Security set to None. (Control Panel-> Mail; Select 'Microsoft Exchange Server'; Click Properties; Select the Advanced Tab; It's down at the bottom)

AND Set LogonUI = False!

By setting LogonUI = False you are telling MAPI NOT do allow any Dialog Boxes to be displayed, But you are requireing the user to supply the credentials in the Profile.

If you require no user intervention, then you MUST set the
Logon Network Security to NT Password Authentication. Additionally the currently logged on User Account (Which includes the DOMAIN) MUST have User permissions to the Mailbox. (If you currently supply a different domain/Username/Password to gain access to your mailbox than what you use to logon to your workstation then this is not the case)





0
 
GathanasCommented:
You can access your mailbox by using the code below.  One condition must be met.  The currently logged on user (Im assuming you are using NT Security Married to Exchange) must have access to the mailbox you are trying to access.  To fully automate the processing run this on an NT server with the scheduling tool and provide the NT logon and password of the id that has access to the mailbox your process is trying to access.  I've done this and it works.

-George


   Dim sExchServer             As String
    Dim sExchUser               As String
    Dim sProfileInfo            As String
    Dim sess                    As MAPI.Session
    Dim sInbox                  As Object

    sExchServer = "Your Exchange Server Name Here"
    sExchUser = "Your MailBox Alias Here"
    'Your Currently logged on account needs to have access to the mailbox
    'This assumes NT Security on both login and exchange


    sProfileInfo = sExchServer + vbLf + sExchUser

    Set sess = New MAPI.Session
    'setting up a session

    sess.Logon , , False, True, 0, , sProfileInfo

    ' Check for a valid logon.
    Set sInbox = sess.Inbox
0
 
damion69Author Commented:
Gathanas, This is telling me nothing more than i already know. as said before i do not have control or access to the exchange box. I can not change permissions ect.



MCummings, NT Password Authentication is what i ahve to set it to inorder for me to even be able to connect. I still can not do this without user inervention.
0
 
GathanasCommented:
You do not need access to the Exchange Box, you need access to the NT Server.  Via the scheduler service you can have the application run with "MCummings" rights and then when the code runs it will login as that person.  What do you see when you step through the code?  Can you post the code you are using to logon (minus confidential info)?
0
 
MCummings111400Commented:
Couple of quick questions;
 What version of Outlook/MAPI is installed?
 What version of Exchnage are you trying to connect to?
 Is the Exchange Server in the same domain?
 If not is it in a trusting Domain?
0
 
damion69Author Commented:
I am using Outlook 2000, but i am not using that as the control, i am using pure mapi. The exchange server is 2000 and it is on a seperate domain, and not trusted. That is why i must enter in the domain, username, and pass to log on to the system.
0
 
MCummings111400Commented:
Ok, one last question before I try something out;

Are your username and passwords the same between the 2 domains?
0
 
fokkerlitCommented:
I know that my usernames are the same but my passwords are different. I tried looking into Redemption.Dll, but it didnt seem to offer any assistance. I noticed people on Microsoft news groups had similar problems, but there was no real resolution there either. There were a few hundred pages of articles, i havent finished going through them as of yet, but i dont know what i will find.
0
 
MCummings111400Commented:
Try changing the passwords so that they match, this will allow the exchange server to authenticate without any intervention. See if it stops the dialog from displaying. You can test it with Outlook too, it should not prompt you for a set of credentials to get access to your mailbox.
0
 
damion69Author Commented:
I found the solution on microsotfs web site, there is not a way to pass it in code...

http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q288775&
0
 
damion69Author Commented:
Please PAQ the resolution was made by myself that this can not be done.
0
 
GathanasCommented:
Thats not true.  I have done this and explained it above.
0
 
twalgraveCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- PAQ'd and points refunded
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

twalgrave
Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.