Jump to content
Rodger

Outlook 2147467260 error - (Moved)

Recommended Posts

Posted (edited)

Hello,

My company uses Outlook 2016 (Office 365). When I run the below script the line "$sCurrentUser = $oNameSpace.CurrentUser" gives a "2147467260" abort error back.

#include "OutlookEX.au3"

_OL_ErrorNotify(2)

$oOutlook = _OL_Open()

If @error <> 0 Then Exit MsgBox(16, "Outlook", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
If isObj($oOutlook) Then
      ConsoleWrite("OBJECT" & @CRLF)
   Else
      ConsoleWrite("NO OBJECT" & @CRLF)
EndIf

$oNameSpace = $oOutlook.GetNameSpace("MAPI")
If @error <> 0 Then Exit MsgBox(16, "Outlook", "Namespace Error 2. @error = " & @error & ", @extended = " & @extended)
If isObj($oNameSpace) Then
      ConsoleWrite("OBJECT" & @CRLF)
   Else
      ConsoleWrite("NO OBJECT" & @CRLF)
EndIf

$sCurrentUser = $oNameSpace.CurrentUser
If @error <> 0 Then Exit MsgBox(16, "Outlook", "Namespace Error 3. @error = " & @error & ", @extended = " & @extended)
If isObj($sCurrentUser) Then
      ConsoleWrite("OBJECT" & @CRLF)
   Else
      ConsoleWrite("NO OBJECT" & @CRLF)
EndIf

_OL_Close($oOutlook)

Exit

When I run this at home (Outlook 2019)  the script works fine.

Am I missing something ?

Thanks for any feedback.

Rodger

Edited by Rodger

Share this post


Link to post
Share on other sites

2147467260 (decimal) stands for: Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)).

Does _OL_ErrorNotify provide any additional information?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Posted (edited)

_OL_ErrorNotify give the below information;  "Afgebroken" means aborted.

 

image.png.9a01cfcb1b93c8af64a1813df7569115.png

 

image.png.7358381cf0c25d536ee7293f84bba988.png

Edited by Rodger

Share this post


Link to post
Share on other sites

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

It seems the script you posted above is not the same script that creates the MsgBox as there is only a "Namespace Error 2" and "Namespace Error 3" in the script you posted.
Can you please post the script that corresponds to the MsgBoxes?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
#include "OutlookEX.au3"

_OL_ErrorNotify(2)

$oOutlook = _OL_Open()

If @error <> 0 Then Exit MsgBox(16, "Outlook", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
If isObj($oOutlook) Then
      ConsoleWrite("OBJECT" & @CRLF)
   Else
      ConsoleWrite("NO OBJECT" & @CRLF)
EndIf

$oNameSpace = $oOutlook.GetNameSpace("MAPI")
If @error <> 0 Then Exit MsgBox(16, "Outlook", "Namespace Error. @error = " & @error & ", @extended = " & @extended)
If isObj($oNameSpace) Then
      ConsoleWrite("OBJECT" & @CRLF)
   Else
      ConsoleWrite("NO OBJECT" & @CRLF)
EndIf


$sCurrentUser = $oNameSpace.CurrentUser
If @error <> 0 Then Exit MsgBox(16, "Outlook", "Namespace Error. @error = " & @error & ", @extended = " & @extended)
If isObj($sCurrentUser) Then
      ConsoleWrite("OBJECT" & @CRLF)
   Else
      ConsoleWrite("NO OBJECT" & @CRLF)
EndIf


_OL_Close($oOutlook)

Exit

 

Share this post


Link to post
Share on other sites

I wonder if you still get the MsgBox from _OL_ErrorNotify stating the error occurred on line 31 - as this is the empty line before _OL_Close :huh:


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

I had a lot of comments at the top which I removed from the code before inserting it in the topic.

It does not change the errormessage, it still occurs at line: 

$sCurrentUser = $oNameSpace.CurrentUser

 

Share this post


Link to post
Share on other sites
Quote

My company uses Outlook 2016 (Office 365)

We are talking about the on premise version, not the cloud version?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

It looks like my company does not allow any external program interacting with Outlook 2016 (Office 365).

I tried the function _OL_AccountGet($oOL)

It fails on these two lines in the function :

        $aAccount[$iIndex][2] = $oAccount.SMTPAddress
        $aAccount[$iIndex][3] = $oAccount.UserName

 

 

Share this post


Link to post
Share on other sites

That's strange as _OL_Open as well interacts with Outlook and the first statement of your script that interacts with Outlook works too :huh:


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Is Outlook already running when you start the script? If yes, could you please try and exit Outlook and let the script start Outlook in the background for you?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Do you run the 32 or 64 bit version of Office/Outlook? The AutoIt script should be compiled/run for the same bitness.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

I run the 32 bits version. 

If I don't start outlook and run the script, I get the below "Name unknown" error:

 

image.png.3b860d682cf9c8df0158da969606b2bc.png

Share this post


Link to post
Share on other sites

This message is expected an can be ignored. 

But the error message shows that you compile your AutoIt script for 64 bit. But it should be for 32 bit as your Outlook is 32 bit too. 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

I compile it as 32bit.

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "OutlookEX.au3"

Share this post


Link to post
Share on other sites
Posted (edited)

Strange. The error message box says @AutoItX64 = 1.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Yeah, but @Compiled = 0


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Posted (edited)

But the macro @AutoItX64 is described as: "Returns 1 if the script is running under the native x64 version of AutoIt."

So my understanding is that the script is executed as X64. And I think this causes the problem we see.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

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...