Posted on 05-24-2016 10:54 PM
We have a situation with the tenant for onedrive and to rebuild the tenant(sadly only solution) we must ensure that all users unlink their accounts, simply disable onedrive is not an option.
Can this be done with applescript or if someone knows some other tool that might be of use? Any tips are welcome!
Posted on 05-26-2016 03:04 AM
I've tried doing Automator to Applescript but it doesn't click on the last "Unlink Account" as displayed in the picture, as if the script doesnt accept the last ui element.
Anyone good at Applescript? Only option left is to manually unlink for all users.
-- Click the menu bar item.
delay 1.536848
set timeoutSeconds to 2.0
set uiScript to "click menu bar item 1 of menu bar 2 of application process "OneDrive""
my doWithTimeout(uiScript, timeoutSeconds)
-- Preferences...
delay 1.1103
set timeoutSeconds to 2.0
set uiScript to "click menu item "Preferences..." of menu 1 of menu bar item 1 of menu bar 2 of application process "OneDrive""
my doWithTimeout(uiScript, timeoutSeconds)
-- Click the “Account” toolbar button.
delay 2.004864
set timeoutSeconds to 2.0
set uiScript to "click UI Element "Account" of tool bar 1 of window "General" of application process "OneDrive""
my doWithTimeout(uiScript, timeoutSeconds)
-- Click the “Unlink Account” button.
delay 1.904296
set timeoutSeconds to 2.0
set uiScript to "click UI Element "Unlink Account" of group 1 of window "Account" of application process "OneDrive""
my doWithTimeout(uiScript, timeoutSeconds)
-- Click the “Unlink Account” button.
delay 1.547241
set timeoutSeconds to 2.0
set uiScript to "click UI Element "Unlink Account" of window 1 of application process "OneDrive""
my doWithTimeout(uiScript, timeoutSeconds)
on doWithTimeout(uiScript, timeoutSeconds)
set endDate to (current date) + timeoutSeconds
repeat
try
run script "tell application "System Events"
" & uiScript & "
end tell"
exit repeat
on error errorMessage
if ((current date) > endDate) then
error "Can not " & uiScript
end if
end try
end repeat
end doWithTimeout
Posted on 05-26-2016 06:19 AM
@Jens.Mansson A member of the OneDrive team just recently joined Slack and might be a good resource to ask about this. I'd recommend joining the #microsoft-office channel and asking there as well. I already forwarded a link to this discussion to the person in question too just in case.
Posted on 05-26-2016 06:28 AM
Just found a plist file at:
~/Library/GroupContainers/UBF8T346G9.OneDriveSyncClientSuite/Library/Preferences/UBF8T346G9.OneDriveSyncClientSuite.plist
which lists my personal and business accounts.
Not done any testing but could be worth a try.
Regards