Pregunta

We're trying to a user in a list item but it's not working. In fact, when we validate the people picker, user is detected and we can validate our form. enter image description here

But when we edit the item, the user is not recognized, and we can't save the form anymore: enter image description here

When we visit the UserInfoList, we can't find this user, but when we use a REST Api request, user data is returned with his Id : enter image description here

Any idea about what's happening ?

¿Fue útil?

Solución

I finally solved the issue. I don't know, till now, why user was not visible in User Information List in the browser but was visible in the json returned by the rest api request, but using the EnsureUser method solved the problem. This is the script that I've used :

function ensureUser(webUrl,loginName)
{
   var payload = { 'logonName': loginName }; 
   return $.ajax({
      url: webUrl + "/_api/web/ensureuser",
      type: "POST",
      contentType: "application/json;odata=verbose",
      data: JSON.stringify(payload),
      headers: {
         "X-RequestDigest": $("#__REQUESTDIGEST").val(),
         "accept": "application/json;odata=verbose"
      },
     success: function(){alert('success');},
     failure: function(){alert('failure');}
   });  
}


var loginName = '<LoginName>'
ensureUser(_spPageContextInfo.webAbsoluteUrl,loginName);

After that, the user was visible again on the User Information List browser UI and we could add him to the people picker and find him after editing the same item.

Otros consejos

To troubleshoot the issue, you could start full synchronization in user profile service application in central administration.

And run the two timer jobs “User Profile to SharePoint Full Synchronization” and “User Profile to SharePoint Quick Synchronization” in the Central administration to sync the user information between user information list and user profile service application.

Licenciado bajo: CC-BY-SA con atribución
scroll top