This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.
You have a K2 environment integrated with SharePoint Online. Whenever you interact with SharePoint Online using the context of the K2 service account, SharePoint Online "sees" the K2 service account as a specific SharePoint Online user based on a cached token.
For example, when the 'Upload Document' method of the SharePoint Online document library SmartObject is being executed inside of the workflow event, then a file gets uploaded to SharePoint Online in the context of a SharePoint Online account which is cached inside of the K2 service account token.
In cases where you specified the wrong SharePoint Online identity while creating this token, it may be necessary to delete this token and create a new one.
Before You Begin
Workflows are being executed in the context of the K2 service account. To interact with SharePoint Online, the K2 service account uses an administrative token created at the time you run the K2 for SharePoint App registration wizard on the app catalog level. When you are running it for the very first time you will get a SharePoint online credential prompt and the credentials you specify there will define the account/context which will be used by the K2 service account to interact with SharePoint Online.
To switch to another account, please do the following:
- Remove the two existing tokens associated with the K2 service account (https://graph.windows.net, https://%your_app_catalog%.sharepoint.com) which have Resource Type = "Microsoft Online"
- You may also have other tokens associated with the K2 service account - one token gets created for each site collection you activate with the K2 for SharePoint App. There is no need to delete them.
- Once the two tokens are removed, run the K2 for SharePoint App registration wizard again. There will be SharePoint Online credential prompts - make sure you use the SharePoint Online account which you want to be used by the K2 service account to interact with SharePoint Online. (You may want to create a dedicated K2 service account in SharePoint online for that.)
- New tokens for the K2 service account will be created.