Jump to content

Creating a login script for Outlook 2010 to add public calender to favorite folder


sam1986
 Share

Recommended Posts

Hello,

I want to create a login script for adding public calender folder to favorite folder

followings are the steps

launch Outlook 2010

Send ctrl + 10

Expand All public folder

Right click on Calender and click on add to favorite

then expand public folder favorite and

right click on calender and select show in favorite.

can we do this a simple script.

Link to comment
Share on other sites

please have a look at my outlook udf. i will post a solution as soon as i am at my pc again.

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 (NEW 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

This example code will add a public folder to the public folder favorites.

You then can add this public folder favorite to the folder favorites as shown in the mail module of the navigation pane (that's another piece of code I'm currently testing).

#include <OutlookEX.au3>
$oOL = _OL_Open()
$aOL_Folder = _OL_FolderAccess($oOL, "Here you enter the folderpath to the public folder you need to access")
If @error <> 0 Then Exit MsgBox(16,"Outlook Script", "Error accessing the public folder. Error: " & @error)
$aOL_Folder[1].AddToPFFavorites
If @error <> 0 Then Exit MsgBox(16,"Outlook Script", "Error adding folder to public folder favorites. Error: " & @error)
_OL_Close($oOL)
Edited by water

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 (NEW 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

  • 11 months later...

Hello Water,

I'm absolutely new with autoit but I guess I'll like it!

Meanwhile, I found out to handle your code for adding a public folder to the public folder favorites and to compile it. But it allways replyes an error "Error accessing the public folder: 1" what I do not know what it means. Could you please assist?

Additionally I'm interested in the mentioned code for adding the public folder favorite to the folder favorites as shown in the mail module of the navigation pane.

Perhaps this is a stupid question, but can one use the autoit-exes to enrole the settings via GPO and script?

Link to comment
Share on other sites

If you want to access a public folder you have to pass parameter $iFolderType as well. Sorry, it's a bug in the example 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 (NEW 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

Thank you for your answer!!! :thumbsup:

$aOL_Folder = _OL_FolderAccess($oOL, "Öffentliche OrdnerAlle Öffentlichen OrdnerFoldername", "Default")

like this?

If yes, it does not work here... :huh:

Is "Default" a wrong parameter here? Which should it be instead?

Link to comment
Share on other sites

No, "Default" isn't correct. You have to pass one of the OlDefaultFolders enumeration (can be found in OutlookExConstants.au3 or MSDN).

For Mail it would be $olFolderInbox.

Edited by water

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 (NEW 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

Cool thing!!!

:idea: Trial and error... I got too many backslashs...

OL_Folder = _OL_FolderAccess($oOL, "Öffentliche OrdnerAlle Öffentlichen Ordnerfoldername", Default)

works as well as

$aOL_Folder = _OL_FolderAccess($oOL, "Öffentliche OrdnerAlle Öffentlichen Ordnerfoldername2", $olFolderInbox).

Any possibility to add the new favourit to the mail module of the navigation pane?????

Edited by ahstax
Link to comment
Share on other sites

You could give _OL_BarShortcutAdd a try.

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 (NEW 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

The following example adds the public folder to the user's Favorites folder by using the AddToPFFavorites method:

$aOL_Folder = _OL_FolderAccess($oOL, "Öffentliche Ordner\Alle Öffentlichen Ordner\foldername", Default)
$aOL_Folder[1].AddToPFFavorites()

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 (NEW 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

  • 2 weeks later...

Hi,

I guess, I understand what you you are trying hard to explaim to me. In my understanding it is not what I am looking for.

On the left side in OL, there is the navigation pane in which also the favourites are. Further there is a button E-Mail, which itselfe contains a favouritearea. To that area I want to add public folders.

Did I explain understandable what I'm looking for?

I would, If I knew how, upload a screenshot of the area...

Link to comment
Share on other sites

To add a screenshot: When creating a new post click on "More Reply Options" and you can attach a file.

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 (NEW 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

I see what you mean. It's a bit more complex than I thougth.

Needs a bit of playing around. Hope to post an example quite soon ...

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 (NEW 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

This should do the trick. The script contains a lot of debugging statements. If you get a row of 0's you can remove them.

#include <OutlookEx.au3>

$oOutlook = _OL_Open()
$Local_Folder = _OL_FolderAccess($oOutlook, "Öffentliche Ordner - <username>Alle Öffentlichen Ordnersubfolder", $olFolderInbox)
ConsoleWrite(@error & @LF)
$Local_Folder[1].AddToPFFavorites
ConsoleWrite(@error & @LF)
$Local_Folder = _OL_FolderAccess($oOutlook, "Öffentliche Ordner - <username>Favoritensubfolder")
ConsoleWrite(@error & @LF)
_OL_AddFavoriteFolder($oOutlook, $Local_Folder[1])
_OL_Close($oOutlook)
Exit

; http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/c1cc6690-049c-45d1-a167-b1c40ba4e0ce
Func _OL_AddFavoriteFolder($oApp, $oFolder)

    Local Const $olModuleMail = 0
    Local Const $olFavoriteFoldersGroup = 4
    Local $oPane = $oApp.ActiveExplorer.NavigationPane
    ConsoleWrite(@error & @LF)
    Local $oModule = $oPane.Modules.GetNavigationModule($olModuleMail)
    ConsoleWrite(@error & @LF)
    Local $oGroup = $oModule.NavigationGroups.GetDefaultNavigationGroup($olFavoriteFoldersGroup)
    ConsoleWrite(@error & @LF)
    $oGroup.NavigationFolders.Add($oFolder)
    ConsoleWrite(@error & @LF)
EndFunc

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