This is a part 2 of blog posts on this subject, you can read part 1 here.

Within the first part of this post, I showed you had to remove the Reply-All functionality via GPO. At its core the process is relatively straight forward (obtain Outlook ADM templates, define policies, link and deploy it). However you have to take some things within this article at "face value". Specifically, the values I provided for the Command Bar ID as well as the values for disabling the keyboard shortcuts within the respective policies.

At this point I wanted to take some time to show you how to verify these for yourself. The benefit being that you would be able to leverage a number of the techniques presented here to successfully disable other shortcuts and/or command buttons should and when you so desire.

Prior to getting started it is worth noting that two separate approaches need to be utilized to obtain the appropriate command and shortcut IDs. Out on the Internet there seems to be a lot of confusion on how to best determine the Command Bar IDs, so I'm going to start with that first as it seems to be giving the most people difficulty.

Determining Command Bar IDs:

In retrospect there are a number of different techniques that could be utilized to obtain the valid Command Bar IDs in Outlook.

  • MSKB 1736004 ((http://support.microsoft.com/kb/173604), actually has a complete list for Outlook 97. I don't know about you... but that is a bit old for my taste, although obviously most of the Command-IDs will stay the same for backwards compatibility, etc. Nevertheless a simple review of that document will show that the Command ID for "Reply All" is = 355.

CommandBar                      Control ID
------------------------------------------
Compose Reply to All               355

  • You could also use a tool like Outlook SPY. Once you become proficient with it the Command IDs will be easily ascertained.

How I did it:

A very easy way to do this is to use Outlook Visual Basic Editor. So the first thing you need to do is enable the VBA Editor if you are not already doing so (most people don't).

To Enable:

  • Open Outlook.
  • Select the Tools menu, and then select Options.
  • Select the "Other" tab.
  • Select Advanced Options.
  • Under "In all Microsoft Office Programs" section select "Show Developer tab in the Ribbon".
  • Select OK.
  • Then Apply and OK on the Options page.
  • Restart Outlook.

Once Outlook has been restarted, you can now use Visual Basic for Applications to determine the Command Button ID for Reply-All.

The code to follow is loosely based on the sample provided in MSKB 173604 with some subtle changes. First this code when executed will create a file on the root of the d:\ named OLIDS.txt. So, if you don't have a d:\ you will need to adjust the code as appropriate to reflect a valid path. However once properly executed you will have an output file in text format with all the valid Command IDs for Outlook.

Steps:

  • Open Visual Basic in Outlook.
  • Add a reference to the Microsoft Scripting Runtime Library (From the Tools menu in the VBA Editor, select References, and then add the Microsoft Scripting Runtime). Once located, select OK to return to the VBA Editor:

  • Paste the following code into your project:

Sub GetIDsForInspector()
      ' The Outlook object library must be referenced.
      Dim objOL As New Outlook.Application
      Dim objCommand As Object
      Set cb = objOL.ActiveExplorer.CommandBars
      ' We will Create a new Text document.
      Dim objtxt
      Dim txtfile
      Set objtxt = CreateObject("Scripting.FileSystemObject")
      Set txtfile = objtxt.CreateTextFile("D:\OLIDs.txt", 8)
         ' 3500 is the maximum # of Controls Outlook has defined.
         For I = 1 To 3500
            Set lbl = cb.FindControl(, I)
            If lbl Is Nothing Then
               ' Do nothing.
            Else
               ' Insert CommandBar name, Command name, and ID.
               txtfile.WriteLine (lbl.Parent.Name & Chr(9) & lbl.Caption & Chr(9) & I)           
            End If
         Next
      End Sub

  • Run the Form. Once done you will notice a text file has been created on the d:\ named OLIDS.txt. Open this file in notepad. You will notice that the Standard Menu Bar has a Command ID of 355 for Reply to All:

Standard     Reply to A&ll 355

Note:

If you didn't care about compiling an entire list of all Command IDs but only wanted to get the value for Reply All, you could substitute the above code with what I have below. This script will simply throw the value into a message box:

Sub GetIDsForInspector()
      ' The Outlook object library must be referenced.
      Dim objOL As New Outlook.Application
      Dim objCommand As Object
      Set cb = objOL.ActiveExplorer.CommandBars
      ' Create a new Text Document.
      Dim objtxt
      Dim txtfile
      Set objtxt = CreateObject("Scripting.FileSystemObject")
      Set txtfile = objtxt.CreateTextFile("D:\ \OLIDs.txt", 8)
         ' 3500 is the maximum # of Controls Outlook has defined.
         For I = 1 To 3500
            Set lbl = cb.FindControl(, I)
            If lbl Is Nothing Then
               ' Do nothing.
            Else
               ' Insert CommandBar name, Command name, and ID.
'Uncomment next 2 lines if you want all Outlook CMD Ids
               'txtfile.WriteLine (lbl.Parent.Name & Chr(9) & lbl.Caption & Chr(9) & I)
               If (InStr(lbl.Caption, "Reply to A&ll")) Then
                MsgBox lbl.Parent.Name & Chr(9) & lbl.Caption & Chr(9) & I
                Exit For
                End If        
            End If
         Next  
   End Sub

So this is where the value of "355" came from in the "Disable Command Bar Buttons and Menu Items Policy" (from Part 1 of this post). Screenshot again:

Determining the Short Cut Key IDs and Modifiers:

As evident from above, the shortcut key consists of two independent numbers separated by a ",". The first number is the actual shortcut key (R in this scenario). To get the proper value you need to convert the ASCII character to a decimal value. This is easy enough to do by simply looking it up in an ASCII table (http://www.asciitable.com/).

As you can see the capital "R" character equates to 82 in Decimal Notation:

So this is how the first number set is defined for the shortcut pair.

The second set of numbers (in this case 12) is determined by the fact that the CTRL + SHIFT modifiers must be used in (conjunction with the R key), to issue the short cut.

The numerical equivalent for the shortcut modifiers:

Alt = 16

Ctrl = 8

Shift = 4

When multiple modifiers are used (as in this case), the numerical values must be added together. So in the case of a Reply All keyboard shortcut that uses (CTRL + SHIFT + R)

CTRL = 8

Shift = 4

Total: 12

This is why we needed to add the value of 82,12 to the Key and Modifier to Disable entry on the Disable Command Bar Buttons and Menu Items Policy. Screenshot again (see Part 1 of this post):

As I mentioned earlier in the post you can apply this knowledge to other Outlook Command IDs and shortcuts rather easily. After deciding on what Outlook Command Button(s) or Short-Cut(s) you want to disable, you simply perform the conversions and add them to the now in-place Custom GPO.

For reference these are some additional Command IDs and shortcuts that should prove as a decent guide for double-checking your understanding of how the conversions are performed:

Item:

Command Bar ID:

Short-cut Pair:

Actual Outlook Short-cut:

New Mail:

1757

78,8

CTRL+N

Send Email:

2617

83,16

ALT+S

Forward Email:

356

70,8

CTRL+F

Print:

4

80,8

CTRL+P

Delete:

478

68,8

CTRL+D

View GAL:

353

66,12

CTRL+SHIFT+B

Move to Folder:

2278

86,12

CTRL+SHIFT+V

Conclusion:

The combination of techniques described in this post provides an easy, legitimate way of disabling Reply-All functionality within the Outlook client (no DCR required!), should and when it be called for. Additionally these techniques can be "massaged" to fit other potential needs with an Active Directory/Exchange/Outlook environment.

I hope you found the post interesting and useful. If you did, please share your thoughts with me by leaving some feedback comments (I do read them!).

Happy Trails!

- Eric Norberg