error at last line:
The authentication endpoint Username was not found on the configured Secure Token Service!
code:
OrganizationServiceProxy proxy;
ClientCredentials deviceCredentials = null;
ClientCredentials clientCredentials = null;
Guid contactId = Guid.Empty;
//Organization URL
Uri OrganizationUri = new Uri("crm14.api.crm5.dynamics.com/.../Organization.svc");
//Discovery URL
Uri HomeRealmUri = new Uri("disco.crm5.dynamics.com/.../Discovery.svc");
//Setting Client Credentials
clientCredentials = GetCredentials("kar.ayush@crm14.onmicrosoft.com", "ayush.9255");
//Get the Device Id and Password
deviceCredentials = GetDeviceCredentials();
//Using Organization Service Proxy to instantiate the CRM Web Service
using (proxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, clientCredentials, deviceCredentials))
{
// This statement is required to enable early-bound type support.
proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
IOrganizationService service = (IOrganizationService)proxy;
String getDmXml =
@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='honda_discountmatrics'>
<attribute name='honda_discountmatricsid' />
<attribute name='honda_name' />
<attribute name='honda_validto' />
<attribute name='honda_status' />
<order attribute='honda_name' descending='false' />
</entity>
</fetch>";
//Now that I've got my FetchXML, I'm going to create a FetchExpression and run the RetrieveMultiple command so
//I can use all the rows from that query.
FetchExpression fetch = new FetchExpression(getDmXml);
//getting error at below line
EntityCollection dmEntityCollection = service.RetrieveMultiple(fetch);