How To Remove O365 Accounts From O365 Activities In UiPath Studio

How to delete O365 Accounts in UiPath Studio (Use Outlook 365)?

When an account is selected to be used in the O365 activities, two things occur.

  1. A cache is created that contains a token for the account so that reauthentication and configuration is not necessary each time the workflow is run (at least not unless the token expires etc.) The cache that holds the token is usually found in one of these locations, (depending on which authentication flow is being used):

%localappdata%\DataStore.Office365

or

%appdata%\uipath\authentication\office365.tokens.cache

  1. The account name/email is stored in the xaml file so that it is visible in the accounts drop-down of the activity.

Steps:

To remove the accounts that are listed in the activity itself, try the following:

Note: Before proceeding with the steps below, take a backup copy of:

  • The project
  • The folders %localappdata%\DataStore.Office365 and/or %appdata%\uipath\authentication\office365.tokens.cache before making changes to the project or removing files from the folders.

  1. Check for the cached accounts / tokens:

If the DataStore.Office365 file exists, make a backup copy of the DataStore.Office365 file and then try deleting the contents of the DataStore.Office365 file.

If the %appdata%\uipath\authentication folder exists, you can make a backup copy of the %appdata%\uipath\authentication folder and then remove the office365.tokens.cache files.

  1. After completing the step above, make a backup copy of the project if this step has not already been completed, and then open the project in Studio.

Click the account dropdown now, and see the accounts are still listed, but they will likely show a red (missing) beside each. To fix this, simply drag in a new Use Outlook 365 activity and the account dropdown should now be clear.

After dragging in the new activity, copy the Do sequence from the old Use Outlook 365 activity into the new activity and then delete the old Use Outlook 365 activity.

Example to remove account names from the Use Outlook 365 Scope Activity:

  1. Make a backup copy of the %appdata%\uipath\authentication folder and then remove the following files from the original folder:
  • accounts.bin
  • tokens.msalcache.bin3

  1. After doing so, open the project in Studio, and click the drop-down for the accounts. The account that was previously being used in the activity should now show as (missing).
  2. Pull in a new Use Outlook 365 activity.
  3. The accounts should be cleared in the new activity after doing so.