Got this working — turns out the issue was with folder-specific permissions (Desktop/Documents). Instead of trying to grant access to each one, I gave OneDrive full disk access using SystemPolicyAllFiles in the PPPC config.
@MoJo Awesome job. Could you share the script that you used to auto-enabled the syncing?
@drewcymek
#!/bin/bash
# This script grabs the user's Office email by
# checking Outlook and Teams config folders.
# - Just pulls the first email it finds
# - User needs to have opened Outlook or Teams before
# - If there are multiple accounts, it grabs the first one
loggedInUser=$(stat -f "%Su" /dev/console)
outlookPath="/Users/$loggedInUser/Library/Group Containers/UBF8T346G9.Office/Outlook/Account Configuration"
teamsPath="/Users/$loggedInUser/Library/Group Containers/UBF8T346G9.Office/Teams/IdentityCache"
userEmail=""
# Check Outlook first
if [ -d "$outlookPath" ]; then
echo "Looking in Outlook config..."
userEmail=$(grep -E -o "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}" "$outlookPath"/* 2>/dev/null | head -n1)
fi
# If not found, try Teams
if [ -z "$userEmail" ] && [ -d "$teamsPath" ]; then
echo "Looking in Teams cache..."
userEmail=$(grep -E -o "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}" "$teamsPath"/* 2>/dev/null | head -n1)
fi
if [ -z "$userEmail" ]; then
echo "No email found for $loggedInUser. Exiting."
exit 1
fi
echo "Found email: $userEmail"
#!/bin/bash
# This script grabs the user's Office email by
# checking Outlook and Teams config folders.
# - Just pulls the first email it finds
# - User needs to have opened Outlook or Teams before
# - If there are multiple accounts, it grabs the first one
loggedInUser=$(stat -f "%Su" /dev/console)
outlookPath="/Users/$loggedInUser/Library/Group Containers/UBF8T346G9.Office/Outlook/Account Configuration"
teamsPath="/Users/$loggedInUser/Library/Group Containers/UBF8T346G9.Office/Teams/IdentityCache"
userEmail=""
# Check Outlook first
if [ -d "$outlookPath" ]; then
echo "Looking in Outlook config..."
userEmail=$(grep -E -o "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}" "$outlookPath"/* 2>/dev/null | head -n1)
fi
# If not found, try Teams
if [ -z "$userEmail" ] && [ -d "$teamsPath" ]; then
echo "Looking in Teams cache..."
userEmail=$(grep -E -o "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}" "$teamsPath"/* 2>/dev/null | head -n1)
fi
if [ -z "$userEmail" ]; then
echo "No email found for $loggedInUser. Exiting."
exit 1
fi
echo "Found email: $userEma
Thanks for that. It seem the script only includes grabbing the user’s email. Is there an additional portion for these steps?