Posted on 03-24-2016 01:43 PM
Sorry for the typo in the title...
Anyone know where I could pull the name of the current outlook 2011identity that is being used to automate removing any older identities that were rebuilt?
Or better yet have written a script that does this?
Cheers,
Pascal
Posted on 04-08-2016 03:04 AM
Hi Pascal,
i had looked into this last year and found that the default identity's name had been stored in some proprietary binary file inside the Library folder. The exact location depends on the language version of Outlook 2011.
You should see the name of the identity in the output of
hexdump -C ~/Library/Application Support/Microsoft/Office/Einstellungen/Office 2011/Outlook Preferences
You would still have to see how you can reliably parse it out of that file.
Cheers
Christoph
Posted on 04-20-2016 11:10 AM
Hey Christoph,
Fancy chatting with you here. I think I found a way to do this fairly safely, could probably need a bit of a clean up and a second set of eyes. Haven't added multi language functionality to this yet. The hexdump idea was the right direction to take but it leaves an extra leading character or two now and again,
xxd /Users/$u/Library/Application Support/Microsoft/Office/Preferences/Office 2011/Outlook Preferences | xxd -r
This works, but to be safe have gone with a double verification process where I am using the user folder with he most recently updated database inside. I've tested this through a few different ways but would love a second set of eyes and can think of an organization that could benefit from it's implementation if you agree / like the direction. Happy for you to edit / improve on the direction I've taken.
Pascal
if pgrep "Microsoft Outlook" > /dev/null
then
echo "Running"
killall "Microsoft Outlook"
fi
UserList="$(ls -1 /Users)"
for u in $UserList ; do #If User Folder Has Outlook 2011 Identities if [ -d /Users/$u/Documents/Microsoft User Data/Office 2011 Identities/ ]; then
#Change to Identities Folder cd /Users/$u/Documents/Microsoft User Data/Office 2011 Identities/
#Save latest Identity to a variable
latestprofile=find . -type f -name "Database" -print0 | xargs -0 stat -f "%m %N" | sort -rn | head -1 | cut -f2- -d" " | sed 's/..//' | sed 's/.........$//'
echo "Profile by directory listing" $latestprofile"
#Compare latestprofiles with preferences config file for accuracy
preferences=xxd /Users/$u/Library/Application Support/Microsoft/Office/Preferences/Office 2011/Outlook Preferences | xxd -r
echo "Profile from preferences files: $preferences"
if [[ "$preferences" == "$latestprofile" ]]; then
#Move Identity to Safety mv "/Users/$u/Documents/Microsoft User Data/Office 2011 Identities/$latestprofile" ..
#Delete the remaining profiles rm -rf *
#Move Identity Back mv "/Users/$u/Documents/Microsoft User Data/$latestprofile" "/Users/$u/Documents/Microsoft User Data/Office 2011 Identities/"
else
echo "$latestprofiles and the identity listed in the prefrences file do not match"
fi
fi
done