Behind the Scenes in an Office 365 Group Mailbox

O365GroupsFoldersHero

A Need to Check Junk Email

My esteemed MVP colleague, Vasil Michev, sometimes gets very hot under the collar about topics that I dismiss. A recent example is his frustration that Microsoft doesn’t have a supported method to allow you access all the folders in a group mailbox. This need arises when he wants to check the Junk Email folder for spam.

Normal EOP Processing

Apparently, some email arriving into a group mailbox ends up in Junk Email. This is the way that things should work as Exchange Online Protection (EOP) processes messages addressed to group mailboxes in the same way as any other mailbox. If a message exceeds the spam threshold, it goes into Junk Email.

Spam might arrive into a group mailbox if you publish the SMTP address for a group outside your organization. For instance, putting a list of group email addresses on your web site is a good way of making sure that spammers will pay attention and add the addresses to their lists.

Normally, group email addresses are not widely known outside an organization. They are unlike the addresses of user or shared mailboxes, which might show up on business cards or as contact addresses on the web. Perhaps people are replacing shared mailboxes with Office 365 Groups now that Microsoft supports the send as and send on behalf of features for these mailboxes.

In any case, I am not quite sure why so many of the group mailboxes Vasil checked receive spam, but he thinks it reasonable to check the Junk Email folder regularly, just in case EOP misdirects some valid email to Junk Email.

Finding Folders in a Group Mailbox

This conclusion then provoked a discussion about how to access folders in a group mailbox. As you probably know, two folders are used for group purposes. The inbox stores conversations and the calendar stores meetings and appointments. But group mailboxes come fully equipped with folders that you do not see and probably do not care about. To get an insight, we run the Get-MailboxFolderStatistics cmdlet. For example, here is real data from an active group mailbox:

[PS] C:\> Get-MailboxFolderStatistics -Identity GroupName | Format-Table Name, ItemsInFolder
Name                                   ItemsInFolder
----                                   -------------
Top of Information Store                           1
Archive                                            0
Calendar                                           6
Clutter                                            0
Contacts                                           0
{06967759-274D-40B2-A3EB-D7F9E73727D7}             0
{A9E2BC46-B3A0-4243-B315-60D991004455}             0
Companies                                          0
GAL Contacts                                       0
Organizational Contacts                            0
PeopleCentricConversation Buddies                  0
Recipient Cache                                    0
Conversation Action Settings                       0
Conversation History                               0
Team Chat                                         16
Deleted Items                                      1
Drafts                                             0
ExternalContacts                                   0
Files                                           1196
Inbox                                           1127
Journal                                            0
Junk Email                                         0
Legacy Archive Journals                            0
MeContact                                          0
Notes                                              0
Outbox                                             0
PersonMetadata                                     0
Sent Items                                       492
Sync Issues                                        0
Tasks                                              0
Yammer Root                                        0
Feeds                                              0
Inbound                                            0
Outbound                                           0
Recoverable Items                                  0
Calendar Logging                                   0
Deletions                                          0
DiscoveryHolds                                 11622
SearchDiscoveryHoldsFolder                         4
MigratedMessages                                   0
Purges                                           275
Versions                                           0

A Mix of Folders

Many of these folders have purely internal purposes (like MeContact and PersonMetaData). Some are used by different clients (like Planner) when they post new items (the Sent Items folder), some when the group mailbox is on hold (DiscoverHolds, Purges, Versions, and SearchDiscoveryHoldsFolder), and some to track the files in the group document library (Files). If the group is team-enabled, the Team Chat folder holds copies of conversations in channels belonging to the team.

In this case, the Junk Email folder for the mailbox holds no items. In other words, spam has not yet made its way to this mailbox, which is what we want. However, Vasil tells us that many group mailboxes hold spam, so we should check whether any mailboxes hold such horrible material.

Scanning All Group Mailboxes in a Tenant

Some PowerShell will quickly detect whether any group mailboxes have spam. Of course, because everyone loves a nice report, we should create a report of groups and list the number of items in the Junk Email folder together with some other information, like the total number of items in the mailbox. I grabbed the script I wrote to check for obsolete Office 365 Groups and modified the code to fetch the data I need. Here are the important bits:

$Groups = Get-UnifiedGroup | Sort-Object DisplayName

ForEach ($G in $Groups)
  { 
   $FolderData = Get-MailboxFolderStatistics -Identity $G.Alias -FolderScope JunkEmail

# Get overall data for the group
  $GroupData = Get-MailboxStatistics -Identity $G.Alias
  $ManagedBy = (Get-Mailbox -Identity $G.ManagedBy[0]).DisplayName
   
# Generate a line for this group for our report
  $Line = @{
     GroupName    = $G.DisplayName
     ManagedBy    = $ManagedBy
     Description  = $G.Notes
     JunkFolder   = $FolderData.Name
     JunkMail     = $FolderData.ItemsInFolder 
     Items        = $GroupData.ItemCount
     Size         = $GroupData.TotalItemSize.Value
  }

  $ReportLine = New-Object PSObject -Property $Line    

# And store the line in the report object
   $Report += $ReportLine

Note that I use the -Scope parameter with Get-MailboxFolderStatistics to limit the check to just one folder and avoid the need to check all the folders that we now know to exist in a group mailbox. An extract of the report generated is shown in Figure 1.

Report Office 365 Group Mailbox spam
Figure 1: : A report about Junk Email folders in Office 365 Groups (image credit: Tony Redmond)

No Spam Here

Our report shows that our group mailboxes are sparklingly clean and not a single piece of spam is visible in any Junk Email folder. All is well.

But the nagging doubt is there that something important might turn up in Junk Email. It is just a doubt, but it then raises the question about what to do if something shows up in your report.

As it turns out, you can open a group mailbox as a shared folder in OWA. Select your name in the list of folder resources and then right click to reveal the extended menu. Select Add shared folder and then enter the name of a group of which you are a member. You can then open and browse through the normal mailbox folders. Figure 2 shows a set of items created by Planner when tasks are assigned to group members. Microsoft does not support this method, but it is available if you need to use it.

Office 365 group Mailbox OWA
Figure 2: Viewing items in a group mailbox with OWA (image credit: Tony Redmond)

If you prefer, you can use Exchange Web Services to grab items from a folder in a group mailbox. Using OWA is much easier, but it is nice to have a choice.

The Inner Life of Groups

Microsoft does not want people poking around in the innards of group mailboxes without good reason. Looking for spam might be one of the times when you look, but remember that group mailboxes are application repositories that just happen to share some characteristics with user mailboxes. In other words, look if you must, but don’t touch unless you know what you are doing.

Follow Tony on Twitter @12Knocksinna.

Want to know more about how to manage Office 365? Find what you need to know in “Office 365 for IT Pros”, the most comprehensive eBook covering all aspects of Office 365. Available in PDF and EPUB formats (suitable for iBooks) or for Amazon Kindle.