I m trying to integrate Dynamics Crm 2015. With the help of this post, Integration to Microsoft Dynamic CRM 2011 , I have written this code:
Dictionary<string, string> parameters = GetCustomParameters(company.Id);
Uri uri = new Uri(parameters["serviceUrl"]);
var username = parameters["username"];
var password = parameters["password"];
var entity = parameters["entity"];
ClientCredentials credentials = new ClientCredentials();
credentials.UserName.UserName = username;
credentials.UserName.Password = password;
OrganizationServiceProxy osproxy = new OrganizationServiceProxy(uri, null, credentials, null);
IOrganizationService _services = (IOrganizationService)osproxy;
QueryExpression query = new QueryExpression()
{
EntityName = entity,
ColumnSet = new ColumnSet("firstname", "lastname", "emailaddress")
};
EntityCollection retrieved = _services.RetrieveMultiple(query);
When I execute this, it prompts:
Value cannot be null.\\r\\nParameter name: detail
Any help would be appreciated. I don't have any previous experiences with CRM integration.
this QueryExpression test is made to work like CRM 2016
it's an example
ConditionExpression condicion1 = new ConditionExpression();
condicion1.AttributeName = "name";
condicion1.Operator = ConditionOperator.NotNull;
FilterExpression filtro = new FilterExpression();
filtro.Conditions.Add(condicion1);
filtro.FilterOperator = LogicalOperator.And;
QueryExpression consulta = new QueryExpression("account");
consulta.Criteria.AddFilter(filtro);
consulta.ColumnSet = new ColumnSet("name", "telephone1");
EntityCollection resultados = service.RetrieveMultiple(consulta);
foreach (Entity c in resultados.Entities)
{
Console.WriteLine("{0} | {1}", c["name"].ToString(), c["telephone1"].ToString());
}
Console.Read();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.