helpinternet

Combining Multiple Office Tool Bars (olkexplorer.officeUI)

Hi! Today we are going to have a post on a more specific and technical topic. I recently found a need to combine a customized Microsoft Office 2016 Outlook tool bar with the user’s existing tool bar – also know as olkexplorer.officeUI. The easy route would be to just force the end user to use the customized bar and loose their existing changes. However, we want to provide the highest level of customer service so we need to keep our end users happy! I spent significant time looking at other forum postings and found no one really covered this topic – hence, I hope this post saves someone a few hours worth of time (or more)!

CAUTION! It is recommended that you have a good understanding of PowerShell and XML prior to working with this code. If you have any questions – please visit the contact section or level a note in the comments.

Now for the fun stuff!

$path_to_office = “$env:USERPROFILE\AppData\Local\Microsoft\Office”

if (-NOT (Test-Path “$path_to_office\olkexplorer.officeUI”))
{
Copy-Item “\\NETWORKSHARE\generic_olkexplorer.officeUI” “$path_to_office\olkexplorer.officeUI”
}

Copy-Item “$path_to_office\olkexplorer.officeUI” “$path_to_office\olkexplorer.officeUI.BAK”

Remove-Item “$path_to_office\olkexplorer.officeUI”

$input = [xml](Get-Content -Path “$path_to_office\olkexplorer.officeUI.BAK”)
$output =[xml](Get-Content “\\NETWORKSHARE\customtoolbar.officeUI”)

Foreach ($Node in $input.customUI.ribbon.tabs.tab)
{
$output.customUI.ribbon.tabs.AppendChild($output.ImportNode($Node, $true))
}

$output.Save(“$path_to_office\olkexplorer.officeUI”)

Great, thanks for visiting, enjoy! Just kidding – let me give you a quick run down of what is going on above.

First, we need to set a variable to the install location of Microsoft Office on the end users computer where we can find olkexplorer.officeUI.

Next, if the user does NOT have a customized toolbar – let’s copy a generic olkexplorer.officeUI from a network share to the local machine. We need to have a generic one to combine our customized toolbar into.

Next, since we are good system administrators – we need a way to get ourselves out of trouble. Therefor, let’s copy the users existing toolbar for backup and then delete the source.

Finally, the last part is our secret sauce – the fun stuff! We take the users Office toolbar and combine it with our custom Office toolbar using PowerShell’s wonderful built in XML interpreter and save the output.

Done!

2 thoughts on “Combining Multiple Office Tool Bars (olkexplorer.officeUI)

  1. Hi,

    I can’t get it work! I always get an InvalidCastToXmlDocument Exception. Could you please provide the source XML of your customtoolbar.officeUI and generic_olkexplorer.officeUI. Seems that mine is not good… (I exported them from Outlook)

    1. Hi there. How did you export from Outlook? All you should need to do is copy the raw file from the location in the script above! Talk soon.

Leave a Reply

Your email address will not be published. Required fields are marked *