Sign in to follow this  
Followers 0
sam1986

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

16 posts in this topic

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.

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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
1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

You could give _OL_BarShortcutAdd a try.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

As far as I understand what I do and did and what _OL_BarShortcutAdd does, it's not what I was looking for...

Or is it also possible to change the menu "Mail" and add favorite-favorites?

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thank you!!!

post-70384-0-79660700-1350991592_thumb.j

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

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
Sign in to follow this  
Followers 0