title: How to allow for a general connection to Dynamics server
body: <p>Finally, I've finished creating the Add-On that does <strong>exactly</strong> what I want in <strong>exactly</strong> the way I want. Only one issue remains. At the moment the software goes to <em>organization</em> and uses <em>credential</em> that are statically hard coded into the program.</p>
  
  <p>I have a hunch that some of my customers might name their organization something else than "<em>Hazaa Inc. #1-5</em>", they could be called something else than "<em>CRMK.local\Konrad</em>" and there's a chance that they even choose a different password than me (although "abc123" is apparently fairly common).</p>
  
  <p>So, here's the issue - how do I make my solution general?</p>
  
  <p>I believe that as long as I get the right input to the code below, I'll be done.</p>
  
  <pre><code>using (OrganizationServiceProxy proxy 
    = new OrganizationServiceProxy(
      organizationUri, 
      homeRealmUri, 
      credentials, 
      deviceCredentials))
  </code></pre>
  
  <p>The current log-in string I copied by hand from "Settings" in the CRM Dynamics but it won't suffice here. I need to obtain it dynamically <strong>and</strong> programmatically. Moreover, even if I learn the name of the organization, I need to determine if it's a CRM 4.0 or CRM 2011, if we're talking On-Line/Premiss what the user name and password are etc.</p>
  
  <p>Is it a better solution to simply ask for that information to be provided by the user or would it be recommended to do that <em>auto-magically</em> (as far as the user experiences it)? This is my first time so most of stuff feels scary and confusing. I've seen some code examples but that led me back to scary &amp; confused very quickly.</p>
  
  <p>EDIT:</p>
  
  <p>I've followed <a href="http://msdn.microsoft.com/en-us/library/hh675400.aspx" rel="nofollow">this code</a> but I simply don't get it. E.g. <code>ServerConnection</code> I don't even know where to find. I tried adding references to the different <code>Xrm</code> and <code>Crm</code> packages in the SDK but it's more of a trial-and-horror than actual development. It feels like I'm missing something (fairly) obvious.</p>