Hello,
My immediate goal is as follows:
SELECT Name
FROM Account
INNER JOIN Contact ON
Account.AccountID = Contact.AccountID
WHERE Account.DeletionStateCode = 2
My code using the SDK is as follows:
int x;
x = 2;
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName =
"Org";
CrmService crm = new CrmService();
crm.Url =
http://appsdev:9999/mscrmservices/2007/crmservice.asmx;
crm.CrmAuthenticationTokenValue = token;
crm.Credentials = System.Net.
CredentialCache.DefaultCredentials;
QueryExpression q1 = new QueryExpression();
ColumnSet cs1 = new ColumnSet();
LinkEntity l1 = new LinkEntity();
ConditionExpression c1 = new ConditionExpression();
FilterExpression f1 = new FilterExpression();
q1.EntityName =
EntityName.account.ToString();
//q1.EntityName = EntityName.contact.ToString();
cs1.Attributes =
new string[] { "Name" };
//l1.JoinOperator = JoinOperator.Inner;
//l1.LinkFromEntityName = "contact";
//l1.LinkFromAttributeName = "accountid";
//l1.LinkToEntityName = "account";
//l1.LinkToAttributeName = "accountid";
c1.AttributeName = "DeletionStateCode";
c1.Operator =
ConditionOperator.Equal;
c1.Values =
new object [] {System.Convert.ToInt32(x)};
f1.FilterOperator =
LogicalOperator.And;
f1.Conditions =
new ConditionExpression[] { c1 };
//q1.LinkEntities = new LinkEntity[] { l1 };
q1.ColumnSet = cs1;
q1.Criteria = f1;
BusinessEntityCollection contacts = crm.RetrieveMultiple(q1);
Just trying to test grabbing all accounts where DeletionStateCode = 2 is failing with a generic Unable To Process Request. I have verified that the token's Org Name and URL are spelled correctly, and that there are indeed records that still exist with a DeletionStateCode = 2.
Any thoughts?