X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Test To See If User Can Access Outlook/exchange Profile And Account, Access 2016    
post Jul 11 2018, 11:09 AM

Posts: 365
Joined: 11-March 15
From: Somewhere lost in the NY Subways

I am working on a tool that will allow users to generate email messages and have them sent via outlook/exchange.

Due to the way that exchange 2016 was updated by MS. We ended up having to use seperate outlook mail profiles.

What I would like to do is see if a user has a specified profile set up. (We are trying to standardize on a given name for profiles... i.e. test_account)

If they do not have the specifed profile/account set up, display a list of profiles they can choose to use.

When trying to do the first test of can they use a profile... I started using some dummy code and I purposely have used both known profiles that I have setup on my computer to which I can use and some that I know dont exist -- however there are no errors or indication that the profile is invalid....

Public Function fTest() As Boolean

    Dim obEmail As outlook.Application
    Dim myNamespace As outlook.NameSpace
    Set obEmail = New outlook.Application
    Set myNamespace = obEmail.GetNamespace("MAPI")
    Debug.Print myNamespace
    myNamespace.Logon "john.smith", , , True
    Set myNamespace = Nothing
    Set obEmail = Nothing

End Function

Therefore, something is telling me that I am doing something wrong....
Go to the top of the page
post Jul 11 2018, 01:19 PM

Posts: 303
Joined: 25-January 16

I tested your code using "MAPI" and then "George" as namespace. MAPI does not error but George does.

You are using a Function procedure but your code does not test for any value to set the Boolean value for the function to return. Are you calling this function from somewhere? Perhaps you should just use a Sub procedure with error handler code.

This post has been edited by June7: Jul 11 2018, 01:35 PM
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    23rd February 2019 - 03:48 AM