Reporting on the Public Folder favorites in a Mailbox utilizing EWS and Powershell

Reporting on the Public Folder favorites in a Mailbox utilizing EWS and Powershell Outlook and OWA permit you to create “Favorites” shortcuts to Public folders (and different folders for that matter) to make accessing them a sooner expertise.

For these of us maintaining tempo with grinding Public Folders into mud (personally not a fan) and changing them with Teams, it possibly helpful to report on which Public Folders folks have Favorited of their mailboxes for a metric and influence standpoint. This data ought to then are available in helpful in case your planing on migrating them (or simply for amusing). As a result of Public folder hierarchies are comparatively advanced having the trail to the Public folder slightly then simply the identify is usually much more helpful. So within the script on this weblog put up we are going to have a look at producing a report of the Public Folder favorites and the Path of the Public Folders these shortcuts discuss with eg it should produce a report one thing like the next for every mailbox you the place to run it towards.

Like different mailbox shortcuts these favorites are FAI (Folder related objects) saved within the Widespread Views Folder within the Non IPM Subtree folder of a Mailbox. Different names for these things are wunderbar or navigation shortcuts and are documented in

EWS permits comparatively quick access to FAI objects in a Mailbox folder through the use of an Related Merchandise traversal within the FindItems operation. eg

$ivItemView.Traversal = [Microsoft.Exchange.WebServices.Data.ItemTraversal]::Related

 To limit the question to only returning these objects which might be public folder shortcuts you must put a restriction on the  PidTagWlinkFlags property.

The precise properties on the FAI Gadgets have to be accessed utilizing prolonged properties in EWS that are documented within the Alternate protocol doc linked above. To work out the trail to folder you must get the PidTagWlinkEntryId property which returns the EntryId of the PublicFolder that the shortcut factors to which you then must convert to an EWSId to entry the Public Folder in query. Nevertheless it isn’t fairly as straight ahead as this as a result of the EntryId that’s returned by this property is not convertible with EWS ConvertId operation due to one of many flag properties used. So some transposition of the EntryId is required, as a result of the EntryId format is documented right here transposing out the incompatible flags so the EntryId can then be utilized in EWS’s convertId operation is not that onerous. eg

$TransposedId = "000000001A447390AA6611CD9BC800AA002FC45A0300" + $Id.Substring(44)
(1A.44.73.90.AA.66.11.CD.9B.C8.00.AA.00.2F.C4.5A. is the supplier Id for Public folder and 0300 is folderType for PublicFolder)

After you have the EWSId of the Public Folder you’ll be able to then entry the PR_Folder_Path property of the folder which ought to return the complete path (with Unicode separators) to the Public Folder in query which you’ll be able to then add to a report. From a permissions perspective this script wants to have the ability to entry the CommonViews folder in a Mailbox and the Public Folder that the shortcut refers to which possibly a fancy factor in some circumstances. As an alternative choice to binding to the Public Folder utilizing EWS to get the Public folder Path in query you might additionally use Distant Powershell (Get-PublicFolder) as a various if permissions trigger a problem.

I’ve put a replica of this script on Git hub

To run this script use Get-PublicFolderShortCuts -MailboxName

Leave a Reply