Hi,
you can create a standard webservice with a new route called UpdateRecord for example. Inside update record you can insert this code:
Uri organizationUri = new Uri("http://localhost/Organization/XRMServices/2011/Organization.svc");
Uri homeRealmUri = null;
ClientCredentials credentials = new ClientCredentials();
//TODO
credentials.Windows.ClientCredential = new NetworkCredential("user", "password");
using (OrganizationServiceProxy _serviceProxy = new OrganizationServiceProxy(
organizationUri,
homeRealmUri,
credentials,
null))
{
_serviceProxy.EnableProxyTypes();
IOrganizationService service = (IOrganizationService)_serviceProxy;
QueryExpression query = new QueryExpression();
query.EntityName = "new_sms";
query.ColumnSet = new ColumnSet(true);
//query.Criteria = new FilterExpression();
//query.Criteria.FilterOperator = LogicalOperator.And;
//query.Criteria.Conditions.Add(new ConditionExpression("new_status", ConditionOperator.Equal, "pending"));
EntityCollection entities = _serviceProxy.RetrieveMultiple(query);
foreach(Entity et in entities)
{
service.Execute(et);
}
}
// Catch any service fault exceptions that Microsoft Dynamics CRM throws.
catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>)
{
// You can handle an exception here or pass it back to the calling method.
throw;
}
catch (Exception ex)
{
throw ex;
}
}
Alessandro Graps