Hello people,
i have a great problem while programming a Windows Phone 8 App. My current problem is, that the app can't authenticate against a Dynamics Server. I am using the sample code provided by Microsoft to log in. This is the code :
public string Verbinden(string username, string passwort) { //var crm = new XrmDataContext(CrmConnection.Parse("Url=https://fitsdevelopment.crm4.dynamics.com; Username=" + username + "; Password=" + passwort + ";")); try { #region Sitzung //Sitzung = CrmConnection.Parse("Url=https://fitsdevelopment.crm4.dynamics.com; Username=" + username + "; Password=" + passwort + ";"); CurrentEnvironment.CreateOffice365UserCredentials(tbxUsername.Text, tbxPasswort.Text); CurrentEnvironment.Initialize(Verbindungschließen, FehlerBerichten); #endregion //Dienst = new OrganizationService(Sitzung); //Kontext = new CrmOrganizationServiceContext(Sitzung); return "Erfolg"; } catch (Exception ex) { return ex.ToString(); } }
The problem is, that i don't get, what CurrentEnvironment.Initialize actually wants. I tried to make those event handlers like
//first try EventHandler<ServiceMetadataLoadedEventArgs> event = new EventHandler<ServiceMetadataLoadedEventArgs>(VerbindungAbschließen()); public void Verbindungschließen(object sender, EventHandler<ServiceMetadataLoadedEventArgs> metadataLoaded) { } //another try CurrentEnvironment.Initialize(new EventHandler, <ServiceMetadataLoadedEventArgs>(VerbindungAbschließen)); public void Verbindungschließen(object sender, EventHandler<ServiceMetadataLoadedEventArgs> metadataLoaded) { }Those lines are the two tries i could remember quickly. To be honest, i don't know very much about events, because i am doing this for an internship. I previously learned how to work with Dynamics CRM and everything worked on desktop and i (mistakenly) thought, that those CRM binaries from SDK worked with Windows Phone too.
Back to topic, my main goal on the short track is to log into Dynamics via the app. The server uses Microsoft ID authentication (claims - based), so a device id is not required. The method should return success, if the procedure ran successfully and if not, the method should return the exception as a string. Do you know, how to code this ?
Thanks in advance