XElement configurationsFromFile = XElement.Load(CrmServiceHelperConstants.ServerCredentialsFile); foreach (XElement config in configurationsFromFile.Nodes()) { Configuration newConfig = new Configuration(); var serverAddress = config.Element("ServerAddress"); if (serverAddress != null) if (!String.IsNullOrEmpty(serverAddress.Value)) newConfig.ServerAddress = serverAddress.Value; var organizationName = config.Element("OrganizationName"); if (organizationName != null) if (!String.IsNullOrEmpty(organizationName.Value)) newConfig.OrganizationName = organizationName.Value; var discoveryUri = config.Element("DiscoveryUri"); if (discoveryUri != null) if (!String.IsNullOrEmpty(discoveryUri.Value)) newConfig.DiscoveryUri = new Uri(discoveryUri.Value); var organizationUri = config.Element("OrganizationUri"); if (organizationUri != null) if (!String.IsNullOrEmpty(organizationUri.Value)) newConfig.OrganizationUri = new Uri(organizationUri.Value); var homeRealmUri = config.Element("HomeRealmUri"); if (homeRealmUri != null) if (!String.IsNullOrEmpty(homeRealmUri.Value)) newConfig.HomeRealmUri = new Uri(homeRealmUri.Value); var vendpointType = config.Element("EndpointType"); if (vendpointType != null) newConfig.EndpointType = RetrieveAuthenticationType(vendpointType.Value); if (config.Element("Credentials").HasElements) { newConfig.Credentials = ParseInCredentials(config.Element("Credentials"), newConfig.EndpointType, newConfig.ServerAddress + ":" + newConfig.OrganizationName + ":" + config.Element("Credentials").Element("UserName").Value); }
Hi,
I have used Early binding to connect with CRM 2011. In that I have used the helper class which is present in the Sample folder in SDK in that all the values are fetched from the Crediental.XML file In that password is not stored it is taken from the user now I do not want to key in Please help .. my XML file is, where to store it and how to retrieve the same in Helper class
<?xml version="1.0" encoding="utf-8"?><Configurations><Configuration><ServerAddress>xtttt</ServerAddress><OrganizationName>crmttt</OrganizationName><DiscoveryUri>http://xtttt/XRMServices/2011/Discovery.svc</DiscoveryUri><OrganizationUri>http://xtttt/crmttt/XRMServices/2011/Organization.svc</OrganizationUri><HomeRealmUri></HomeRealmUri><Credentials><UserName>b.ttt</UserName><Domain>Domainttt</Domain></Credentials><EndpointType>ActiveDirectory</EndpointType><UserPrincipalName></UserPrincipalName></Configuration></Configurations>