string connectionStr = @"Url=https://xxx.crm4.dynamics.com; Username=xxx-crm@xxx.com;Password=xxxx;";
Microsoft.Xrm.Client.CrmConnection connection = CrmConnection.Parse(connectionStr);
Console.WriteLine("Connecting...");
// Obtain an organization service proxy.
// The using statement assures that the service proxy will be properly disposed.
using (var _orgService = new OrganizationService(connection))
{
WhoAmIResponse resp = (WhoAmIResponse)_orgService.Execute(new WhoAmIRequest());
Console.WriteLine("UserId : " + resp.UserId.ToString());
Console.Write("OK!!");
Console.ReadKey();
}