Jump to content

Recommended Posts

Posted

Hi,

I'm fairly new to AutoIt, so please forgive me for asking. I have already searched and found a similar topic ( 

but I can't seem to get it working.

I can only connect to the default user/mailbox, but not other mailboxes. I have my.name@company.com and also access to a few generic support mailboxes in the company, xyz@company.com and bla@company.com. Accessing my.name@company.com works fine, but I need access to the inbox from the other mailboxes.

The example au3 for FolderAccess gives an error when I try to use it with, for example, bla@company.com

I have read the wiki https://www.autoitscript.com/wiki/OutlookEX_UDF_-_Folder_Item

Does someone have a working code snippet for this particular problem?

Many thanks.

Posted

Can you please post the code snippet where you access the folder?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()

$aFolder = _OL_FolderAccess($oOutlook, "bla@company.com")
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderAccess Example Script", "Error accessing the default contacts folder. @error = " & @error)
$aFolder[1].Display
MsgBox(64, "OutlookEX UDF: _OL_FolderAccess Example Script", "Default contacts folder successfully accessed and displayed.")

_OL_Close($oOutlook)

A very short version of your FolderAccess example code. This code gives error 4, if I use \\bla@company.com I get error 1.

Posted (edited)

Could you please try: _OL_FolderAccess($oOutlook, "\\bla@company.com\", $olFolderInbox)

Edited by water
Parameter 1 was missing - hence the error

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
13 minutes ago, water said:

Could you please try: _OL_FolderAccess("\\bla@company.com\", $olFolderInbox) 

That also gives error 4.

I tried referencing the account by name instead of email address and that seems to do more. It opens up a search (for the correct account!), but not the Inbox / number of emails in the Inbox. Is OutlookEX compatible with Outlook 365?

 

Posted
3 hours ago, MCv said:

Is OutlookEX compatible with Outlook 365?

Only with the on premise version not the cloud based. Which one do you run?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
51 minutes ago, water said:

Only with the on premise version not the cloud based. Which one do you run?

How can I tell? I'm just an employee :)

Posted

I only use Office 2016.
So I had a look at Google: https://www.howtogeek.com/354238/whats-the-latest-version-of-microsoft-office/

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

I have Outlook 365 ProPlus. I don't know what installation method the IT people have chosen though.

Do you have a suggestion/improvement for the referencing by name and not getting the Inbox?

Posted

The OutlookEX UDF does only support local installations of Outlook.
So I suggest to ask the IT people if there is a local installation.

I had a look at your script and noticed that you do not check for errors after _OL_Open. If there is no local Office installation then you should get an error raised by _OL_Open.
Can you please check?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
$aFolder = _OL_FolderAccess("\\bla@company.com\", $olFolderInbox) 
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderAccess Example Script", "Error accessing the default contacts folder. @error = " & @error)
$aFolder[1].Display
MsgBox(64, "OutlookEX UDF: _OL_FolderAccess Example Script", "Default contacts folder successfully accessed and displayed.")

_OL_Close($oOutlook)

Added the error check: no errors on _OL_Open, just the error on _OL_FolderAccess. So I guess it's a local installation. I have another AutoIt/OutlookEX script for the default account and that works fine.

Posted

Looks good so far. Seems we need to do additional tests. 

Will be back in a few hours. 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
$aFolder = _OL_FolderAccess($oOutlook, "ACCOUNT NAME") 
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderAccess Example Script", "Error accessing the default contacts folder. @error = " & @error)
$aFolder[1].Display
MsgBox(64, "OutlookEX UDF: _OL_FolderAccess Example Script", "Default contacts folder successfully accessed and displayed.")

_OL_Close($oOutlook)

This is what my most successful version looks like. This opens an Outlook window that lets you search in the correct mailbox, but doesn't show the Inbox.

Posted

Btw, adding , $olFolderInbox) to _OL_FolderAccess in the above example doersn't make any difference.

Posted (edited)

Well, I opened the code of _OL_FolderAccess, and I don't believe it is possible to use "\\bla@company.com".  Seems to me that you would need to use "\\FisrtName Name" format.  However I tried using it but it doesn't work either for me. (Outlook 2003 here). 

@water The first line of code of the function is highly suspicious. 

If $sFolder = "" = Default Then $sFolder = ""

And the problem seems to come from those 3 lines

Local $oDummy = $oNamespace.CreateRecipient("=" & $aFolders[1]) ; Create Recipient. "=" sets resolve to strict
$oDummy.Resolve ; Resolve
If Not $oDummy.Resolved Then Return SetError(2, 0, "")

I tried some modifs to make it work, unsuccessfully

Edit - Reading MSDN

RecipientName    Required    String    The name of the recipient; it can be a string representing the display name, the alias, or the full SMTP email address of the recipient.

So it should also work with  "\\bla@company.com"

Edited by Nine
Posted
1 hour ago, Nine said:

Edit - Reading MSDN

RecipientName    Required    String    The name of the recipient; it can be a string representing the display name, the alias, or the full SMTP email address of the recipient.

So it should also work with  "\\bla@company.com"

You are referring to https://docs.microsoft.com/en-us/office/vba/api/outlook.recipients ?

Posted
4 hours ago, Nine said:

If $sFolder = "" = Default Then $sFolder = ""

That's correct, it's a bug!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Can you please post a screenshot of Outlook after you have manually connected to the other mailbox (all private info can be greyed out)?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...