Jump to content

[Error] Outlook + Profile Admin


Recommended Posts

 

Hello guys,

 

I'm having a problem reading Outlook when I use #RequireAdmin, as far as I understand it, it can not read the Outlook Profile that is configured from the user running the application.

I need to run some parameters with #RequireAdmin after it reads Outlook.

$oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_Open",  "Example Error" &  ". @error = " & @error & ", @extended = " & @extended)

This retunr is @Error=1

Can you help me?

Edited by Blois
Link to post
Share on other sites

If you use 2 scripts, one that run with RequireAdmin, and the launcher that doesn't you can use the launching script to get the information from the logged on user, and the second script can be run under admin, and gets information from the first script.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites

What's the value of @extended after _OL_Open?
The wiki (https://www.autoitscript.com/wiki/OutlookEX_UDF_-_General#Debugging) explains the problems you might face when using #RequireAdmin.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Can you make sure that Outlook is not running when you start your script with #Requireadmin?
As described in the wiki:

Running script as Administrator

It seems that the process that starts or hooks into Outlook needs to be run with the same permissions as Outlook.

You get the following error when setting _OL_ErrorNotify(2):

 NumberHex = 800401E3
 Number = -2147221021
 WinDesciption = Operation Unavailable

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

You know that you can specify which profile to use when calling _OL_Open?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Or you could make sure that _OL_Open opens Outlook so it is being run as Administrator:

#RequireAdmin
#include <OutlookEx.au3>
If ProcessExists("Outlook.exe") Then
    ProcessClose("Outlook.exe")
    If @error Then Exit Msgbox(0, "ProcessClose", "Error " & @error occurred when closing Outlook. Please close Outlook manually and restart the script!")
EndIf

Global $oOL = _OL_Open()
; Rest of your script

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites
20 minutes ago, water said:

Or you could make sure that _OL_Open opens Outlook so it is being run as Administrator:

#RequireAdmin
#include <OutlookEx.au3>
If ProcessExists("Outlook.exe") Then
    ProcessClose("Outlook.exe")
    If @error Then Exit Msgbox(0, "ProcessClose", "Error " & @error occurred when closing Outlook. Please close Outlook manually and restart the script!")
EndIf

Global $oOL = _OL_Open()
; Rest of your script

 

Perfect! Tks.

Link to post
Share on other sites

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By caramen
      @water Tips please ? 
       
      I whould like to check a mail box. Check each mails that is coming and also 'Do' if a particular tag is in the mail subject. 
       
      Well i know I am gonna use 'RegExp' with '_OL_MailheaderGet' from the outlook UDF
       
      And i already tryed them. But when i tryed '_OL_MailheaderGet' If i use the patterne [0] I will get the first mail received. 
       
      Any way to get the last mail received header ? without doing an UBound (may i ll have somthing like 500 mails to unbound...) ? 
      Or i am using the function wrong ?
       
       
    • By water
      My computer has been upgraded from Office 2010 to Office 2016.
      Are there any features of Office 2013 or Office 2016 which you now want to see in the Excel, Word or Outlook UDF?
    • By Happy82
      I am trying to access the inbox in my outlook. I have 2 inbox. One is associated to my name. Another one is shared inbox between 3. I am able to read/write emails on both the inbox.
      I am using the following code
      #include <OutlookEX.au3> Global $oOutlook = _OL_Open() Global $aFolder = _OL_FolderAccess($oOutlook, "\\Expense Reports\Inbox", Default, Default) If @error Then MsgBox(0, "Error", "Error Accessing Inbox: " & ":" & @error, 5) Exit Else MsgBox(0, "Success", "Success Accessing " , 5) EndIf _OL_Close($oOutlook) it gives me the error code 1.
      Instead of "\\Expense Reports\Inbox" if i use "*" which points to my inbox it works.
      I have access to the folder \\Expense Reports\Inbox. I can read/write the emails from that folder.
      Any help .......
      Also if i change "*" to "\\angamuthus@xxxx.co" which is my actual root folder. I still get the error 3: Error accessing specified folder.
       
      Can some throw some light on this......
×
×
  • Create New...