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.

Issue

When updating a list item field of type "person or group" in SharePoint, it fails to update and an error appears:

"Error: The user or group [NAME] could not be found in SharePoint"

This only occurs if the following is true:

- You have multiple users with the same Name and Last name but there are unique users when looking at UPN and email address:

Jon Doe - jon.doe1@domain.com

Jon Doe - jon.doe2@domain.com 

- Both these users are unique and 2 different people.

- When the user logs into SharePoint, SharePoint ensures the user and adds the user to the “User Information List” in SharePoint. Now when passing data from K2 to the SharePoint list, you need to ensure the data is unique, in the above scenario if you pass the Name and Last name “Jon Doe” the error will occur since SharePoint cannot resolve the column due to multiple results. 

This can be reproduced outside of K2 by running the below powershell:

Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"

Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#SPOnline

$SiteUrl = "SITE URL"

$LookupUser = "[Jon doe]"

$LogonUser = "[GLOBAL ADMIN ACCOUNT]"

$Password = ConvertTo-SecureString "[PASSWORD]" -AsPlainText -Force

$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)

$Context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($LogonUser,$Password)

 

#EnsureUser

$identity =$Context.Web.EnsureUser($LookupUser)

$Context.Load($identity)

$Context.ExecuteQuery()

 

Write-Host "LoginName:" $identity.LoginName

$identity.UserId 

This will cause an error:

"Exception calling "ExecuteQuery" with "0" argument(s): "The specified user Jon Doe could not be found."

Symptoms

When updating a list item "person" or "group" field in SharePoint, it fails and an error appears.

Resolution

This is a design consideration / best practice. The correct strategy here is to consider the data being sent to SharePoint and to be sure it is unique for each user (like the email address).

As a temporary fix:

Delete one of the users from the "User Information List."

User information list [SITE URL]/_catalogs/users/detail.aspx?

You can add “&force=1” at the end of the link to enable you to just delete from here “[SITE URL]/_layouts/15/people.aspx?MembershipGroupId=0”

Once the deleted account's user logs into SharePoint again, the entry will be added back and the issue will also reappear.