///
/// This fucntion will connect to CRM 1.2
///
///
private Microsoft.CRM.Proxy.CUserAuth connectToCRM()
{
// BizUser proxy object
Microsoft.CRM.Proxy.BizUser bizUser = new Microsoft.CRM.Proxy.BizUser();
bizUser.Credentials = new System.Net.NetworkCredential(userName, password, domain);
bizUser.Url = strDir + "BizUser.srf";
try
{
userAuth = bizUser.WhoAmI();
//MessageBox.Show("Sucessfully connected to CRM 1.2");
}
catch (System.Web.Services.Protocols.SoapException ex)
{
MessageBox.Show("Unable to connect to CRM 1.2, Please check CRM 1.2 details.", ex.Message.ToString());
return null;
}
return userAuth;
}
#endregion
No comments:
Post a Comment