0

I'm writing a script actually that deletes some elements from the public folder "favorites" in Outlook 2010. I now want to create a shortcut from the folder "all public folders" to "favorites", but I don't no how to do this. I start the following:

#Create Outlook instanz from current process
$ol=[Runtime.Interopservices.Marshal]::GetActiveObject('Outlook.Application')
#Creating Namespace
$namespace = $ol.GetNamespace("MAPI")

Taking the folder source path from the "all public folders" and taking my destination port in "favorites" If I start with $ol.copyfiles($source, $destination) it tells my, that copying is not allowed only linking/shortcut, but that's the problem I can't find any way (cmdlet) to make a shortcut or link.

Thanks for help

EDIT: I am already at that point

#Delete Linked folder from favorites $namespace.folders.item(1).folders.item(1).folders.item(1).delete

So how can I create a new shortcut underneath?

  • possible duplicate of [Outlook. Add folder to favorites group](http://stackoverflow.com/questions/12935579/outlook-add-folder-to-favorites-group) – Eugene Astafiev Feb 25 '15 at 14:46

2 Answers2

0

Take a look at the similar forum thread which states the following:

You can manage the Outlook favorites group by accessing the NavigationPane module.

utlook.MailModule mailModule = ThisAddIn.Application.ActiveExplorer().NavigationPane.Modules.GetNavigationModule(Outlook.OlNavigationModuleType.olModuleMail) as Outlook.MailModule; 
Outlook.NavigationGroup favGroup = mailModule.NavigationGroups.GetDefaultNavigationGroup(Outlook.OlGroupType.olFavoriteFoldersGroup);
favGroup.NavigationFolders.Add(objFolder);
Community
  • 1
  • 1
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • This Suggestion is not working as I expected. I get in the end to the same point as I was and I'm not directly able to use this vba code. I tried to change it to powershell but the result is, I am not able to add the folder to favorites. I can't even enter the navigation pane of favorites. –  Feb 25 '15 at 15:11
  • Okay, I managed to do this, but the "add" command is not available for permission reasons. I don't want to add a folder in public favorites, I just want to make the same like "Rightclick - Add to favorites" in Public folder. is there a way to do this? –  Feb 26 '15 at 07:41
  • Can you do that manually? Make sure that you have all the required permissions. – Eugene Astafiev Feb 26 '15 at 08:07
  • Yeah I am able to do it manually, it show's up in favorites as exspected is there an equivalent to "Show in favorites"? –  Feb 26 '15 at 08:47
0

I finally got it, it's simply: addtopffavorites()