Jump to content

Fail to access a public folder using OutlookEx UDF?


Recommended Posts

Hello guys,

I am trying to access a public folder using its local path:

 

#include <OutlookEX 1.6.2.0\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)

If Not FileExists("C:\Users\Bijo\AppData\Local\Microsoft\Outlook\bijo@Duncom.org - bijo.ost") Then Exit MsgBox(16, "My Script", "PST 'C:\Users\Bijo\AppData\Local\Microsoft\Outlook\bijo@Duncom.org - bijo.ost' does not exist")

Global $oPST = _OL_PSTAccess($oOutlook, "C:\Users\Bijo\AppData\Local\Microsoft\Outlook\bijo@Duncom.org - bijo.ost", "Outlook-UDF-OST")

If @error <> 0 Then Exit MsgBox(16, "My Script", "Error accessing 'C:\Users\Bijo\AppData\Local\Microsoft\Outlook\bijo@Duncom.org - bijo.ost' archive. @error = " & @error & ", @extended: " & @extended)

But I get error 3 with a negative big extended value on the last error MsgBox:

Error adding the PST file as an Outlook store. @extended is set to the COM error

What do I miss here?
 

Thank you!

Link to comment
Share on other sites

Are you able to add this PST file to Outlook manually? If not what error message does outlook give you?

(Also, _OL_PSTAccess checks that the file exists for you, so you don't actually need to check that :))

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

Oh! That can be confusing. For example, to access my public folders, I need to use this code:

Local $oOL = _OL_Open()
If @error Then Exit ConsoleWrite("_OL_Open" & @CRLF)

Local $aFolder = _OL_FolderAccess($oOL, "Public Folders - <MyEmail@Address>\All Public Folders\")
If @error Then Exit ConsoleWrite("_OL_FolderAccess" & @CRLF)

ConsoleWrite("Folder: " & $aFolder[1].FolderPath & @CRLF)

The OutlookEx documentation states that using *\<Path> will default to your public folders, but for me, at least, that resolves to this path instead: \\<MyEmail@Address>\

Basically, the easiest way to get a path for a folder in Outlook is to right click the folder, select properties, and copy\paste the full path (location). (This will get you the parent folder, so don't forget to add the current folder's name on to the end)

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

Seems you mixed PST and OST.
A PST is a store located on your local storage and holds your items.
An OST is a store located on your local storage holding COPIES of items stored in Exchange or other places you connect to via a network.
You can access a PST using the OutlookEX UDF but you can't access an OST - you always have to access the network location. If you are working offline, Outlook accesses the OST and syncs it with the network store as soon as you are connected with the network again.

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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...