title: "Encoded" login names in SharePoint Client Object Model
body: <p>I'm writing a small .NET proof-of-concept console app that performs a series of actions on a SharePoint document library. I noticed that the following methods expect an "encoded" login name - that is, login name including provider information, e.g. <code>i:0#.w|DOMAIN\user</code>.</p>
  
  <pre><code>context.Web.EnsureUser(encodedLoginName);
  context.Web.SiteUsers.GetByLoginName(encodedLoginName);
  </code></pre>
  
  <p>How do I reliably convert a user name such as <code>DOMAIN\user</code> to this encoded format in the <strong>SharePoint Client Object Model</strong>?</p>
  
  <p>I've read a <a href="http://zimmergren.net/technical/tip-getting-the-normal-domain-username-from-the-claims-username-in-sharepoint-2013">couple</a> of <a href="http://blog.mastykarz.nl/programmatically-converting-login-name-claim/">blog posts</a> that address this issue with the <code>SPClaimProviderManager</code>, which is not available in the client API.</p>