Skip to content

Commit

Permalink
Fix for New Outlook binary parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
pbowden-msft authored Apr 15, 2021
1 parent 9f5f584 commit 66ae271
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Outlook_AddIns.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/zsh
# set -x

## Extension Attribute to report the list of web-based add-ins that Outlook has loaded
## Extension Attribute to report the list of modern web-based add-ins that Outlook has loaded

GetLoggedInUser() {
LOGGEDIN=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/&&!/loginwindow/{print $3}')
Expand All @@ -23,7 +24,8 @@ GetHomeFolder() {
}

GetManifestsFolder() {
MANIFESTPATH=$(/usr/bin/find "$HOME/Library/Containers/com.microsoft.Outlook/Data/Library/Application Support/Microsoft/Office/16.0/Wef" -name 'Manifests')
# Outlook can create multiple Manifests folders, so get the most recent
MANIFESTPATH=$(print -lr -- $HOME/Library/Containers/com.microsoft.Outlook/Data/Library/Application\ Support/Microsoft/Office/16.0/Wef/**/Manifests(om[1,1]))
echo "$MANIFESTPATH"
}

Expand All @@ -35,7 +37,8 @@ ManifestsFolder=$(GetManifestsFolder)
# Enumerate files in the Manifests folder
if [ -d "$ManifestsFolder" ]; then
for manifest in $ManifestsFolder/**; do
ADDIN=$(cat "$manifest" | grep '<DisplayName' | cut -d '"' -f2)
# New Outlook uses binary-based manifests, so we need to remove non-text characters as part of the grep
ADDIN=$(cat "$manifest" | LC_ALL=C tr -d '[\000-\011\013-\037\177-\377]' | grep '<DisplayName' | cut -d '"' -f2 | sed -e 's/^[[:space:]]*//')
if [ "$ADDIN" != "" ]; then
AddInList+="$ADDIN;"
fi
Expand Down

0 comments on commit 66ae271

Please sign in to comment.