Power BI

Content by Charles Sterling

How to enumerate messages and conversations in a folder using the Outlook.Application object model

I am always amazed at how much mail we generate and go through at Microsoft. Lately I was asked to create and send mail on how much mail the ALM MVPs generate (pretty certain the irony of this request was lost on the person requesting it).

But in either case like a good little worker bee I finally imported our ALM MVP discussion list into Outlook took a look at our stats (and sent the email requested). As part of this exercise I did write a little code in Visual Studio 2012 to automate this task going forward.



Imports Microsoft.Office.Interop

Private Sub Main()

Dim objOutlook As New Outlook.Application

Dim objnSpace As Object = objOutlook.GetNamespace("MAPI")

objnSpace = objOutlook.GetNamespace("MAPI")


Dim olkFld As Outlook.Folder = objOutlook.Session.Folders(1) ‘Root

Dim olkFld1 As Outlook.Folder = olkFld.Folders(2) ‘INBOX

‘ Dim unreadItems As Outlook.Items = olkFld1.Items

My.Computer.FileSystem.WriteAllText("TheFile.txt", vbCrLf, False) ‘clean out the file

My.Computer.FileSystem.WriteAllText("TheFile.txt", olkFld1.FolderPath, True)

My.Computer.FileSystem.WriteAllText("TheFile.txt", vbCrLf, True)


For Each objMessage In olkFld1.Items

‘My.Computer.FileSystem.WriteAllText("TheFile.txt", objmessage.Sender.Address, True)

‘My.Computer.FileSystem.WriteAllText("TheFile.txt", vbTab, True)

My.Computer.FileSystem.WriteAllText("TheFile.txt", objMessage.ConversationTopic, True)

My.Computer.FileSystem.WriteAllText("TheFile.txt", vbCrLf, True)

Next objMessage

End Sub


Net net is the ~100 ALM MVPs generate over 1,000 messages a MONTH!


  • Total Messages                                                             8,983
  • Create Date                                                                3/16/2012
  • Messages per month                                                    1779
  • Minutes to manually gather this data                          33


Update 5/17/2013 we are now up to                                     22,024                                                      


Top Posters in the last 5 months

  1. Brian Harry                                                      1012
  2. Brian Randell                                                   550
  3. Neno Loje                                                       489
  4. Tiago Pascoal                                                  377
  5. Adam Cogan                                                    343
  6. Martin Hinshelwood                                        312
  7. Jeff Levinson                                                  314
  8. Ed Blankenship                                                279
  9. Buck Hodges                                                    208
  10. Chris Paterson                                                 173


Topics by popularity

  1. State of ALM                                                62
  2. Lap Around VS/ALM Deck                            51
  3. RC release(Win8 Compat and Colors)           34
  4. TFS Preview Portal                                       31
  5. Brian Keller VM                                             31
  6. TFS Preview                                                  26
  7. Certifications                                                27
  8. Microsoft Test Manager                                24
  9. Windows Server 2012                                    23
  10. Microsoft Feedback tool                               22



  • Total number of members                                    367
  • % Microsoft                                                           65%
  • %MVPs                                                                  33%
  • %Other                                                                  2%
  • %Traffic by MSFT*                                                 41%

While Neno and Tiago are MVPs they are also our TS in their regions (as a vendor)…not certain they shouldn’t be counted in both categories!