We have a winforms app which pulls all lists from Office 365 SharePoint site. Recently I started getting error "user not found". I can login to the SP site https://[name].sharepoint.com/sites/[folder1]/[userfolder]/SitePages/Home.aspx from browser and see all lists. However when I run the winforms app, it throws error.
MsOnlineClaimsHelper claimsHelper = new MsOnlineClaimsHelper(sharePointSite, sharePointUser, sharePointPassword);
ClientContext clientContext = new ClientContext(sharePointSite);
clientContext.ExecutingWebRequest += claimsHelper.clientContext_ExecutingWebRequest;
clientContext.Load(clientContext.Web);
clientContext.ExecuteQuery();
Web web = clientContext.Web;
// Retrieve all lists from the server.
clientContext.Load(web.Lists);
clientContext.ExecuteQuery(); //<-- Throws error here
Error
Message "User cannot be found." string
ServerErrorCode -2146232832 int
ServerErrorDetails null object
ServerErrorTraceCorrelationId "ee687f9d-c05a-2000-2113-22de7e4f8fe1" string
ServerErrorTypeName "Microsoft.SharePoint.SPException" string
ServerErrorValue null string
ServerStackTrace "" string
Similar (didn't help) : Sharepoint 2010 user not found error
I am fetching lists, not sure if this is related. : https://social.technet.microsoft.com/Forums/office/en-US/f9221c7b-f835-4041-ac21-ab896bae106f/microsoftsharepointspexception-user-cannot-be-found?forum=sharepointgeneralprevious
Help/suggestions much appreciated! Thank you!
MsOnlineClaimsHelperhave issues and because of that the Sharepoint query is executing but for some reason the user isn't being found. - jaredbaszler