Please find the below sample code which works perfectly in visual studio with .net assemblies. However if we try to integrate the code in Monotouch and try to run , we are facing compatibility issues with the dlls like system.servicemodel.description.... where it doesnt support clientcredentials and system.runtime.serialization.
awaiting for any help from your end.
/Authenticate using credentials of the logged in user;
string UserName = "xxx.onmicrosoft.com"; //your Windows Live ID
string Password = "xxx"; // your password
ClientCredentials Credentials = new ClientCredentials();
Credentials.UserName.UserName = UserName;
Credentials.UserName.Password = Password;
//Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
//This URL needs to be updated to match the servername and Organization for the environment.
Uri OrganizationUri = new Uri("xxx.crm5.dynamics.com/.../Organization.svc"); //this URL could copy from Setting --> Developer Source
Uri HomeRealmUri = null;
//OrganizationServiceProxy serviceProxy;
using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, GetDeviceCredentials()))
{
IOrganizationService service = (IOrganizationService)serviceProxy;
//Instantiate the contact object and populate the attributes.
Entity contact = new Entity("contact");
contact["firstname"] = "test1";
contact ["lastname"] = "hello";
contact["emailaddress1"] ="test@gmail.com";
Guid newContactId = service.Create(contact);