Ben
Fri Jun 02 15:20:02 CDT 2006
Here is what I'm doing.. Good Luck..
private void CRMLetterDeleteByGuid(Guid ownerId , CRMSDK.EntityName
ownerType)
{
// since were going to deal with contact and leads, and i'm haardcoding
this
int ownerTypeId = 0;
switch(ownerType)
{
case CRMSDK.EntityName.lead:
{
ownerTypeId= 4;
break;
}
case CRMSDK.EntityName.contact:
{
ownerTypeId= 2;
break;
}
}
// Columns to return
CRMSDK.ColumnSet cols = new ColumnSet();
cols.Attributes = new string [] {"activityid"};
// Conditional expression ~ entity.entityid == phonecall.regardingobjectid
CRMSDK.ConditionExpression identityCondition = new ConditionExpression();
identityCondition.AttributeName = "regardingobjectid";
identityCondition.Operator = CRMSDK.ConditionOperator.Equal;
identityCondition.Values = new object [1];
identityCondition.Values[0] = ownerId.ToString();
// Conditional expression ~ phonecall.regardingobjecttypecode ==
entity.type
CRMSDK.ConditionExpression typeCondition = new ConditionExpression();
typeCondition.AttributeName = "regardingobjecttypecode";
typeCondition.Operator = CRMSDK.ConditionOperator.Equal;
typeCondition.Values = new object [1];
typeCondition.Values[0] = ownerTypeId;
// Filter on condition expression
FilterExpression filter = new FilterExpression();
filter.FilterOperator = LogicalOperator.And;
filter.Conditions = new ConditionExpression[] {identityCondition,
typeCondition};
QueryExpression query = new QueryExpression();
query.EntityName = Utils.CRMSDK.EntityName.letter.ToString();
query.ColumnSet = cols;
query.Criteria = filter;
CRMSDK.BusinessEntityCollection entities =
this.CRMService.RetrieveMultiple(query);
foreach ( Object oLetter in entities.BusinessEntities )
{
crmLetter = (CRMSDK.letter) oLetter;
Guid letterGuid = crmLetter.activityid.Value;
crmService.Delete(CRMSDK.EntityName.letter.ToString(), letterGuid);
}
}
"Mike Christl" wrote:
> Hi and thanks for the post.
>
> John is correct in his reply. If any direct sql updates are made data
> integretity would be threatened. This would leave your CRM install in an
> unsupported state.
>
> However I can see where this would be an important feature for future
> releases of CRM.
>
> We are very interested in your thoughts and opinions for improvements that
> we can make to provide the features and functionality you and your
> customers would like to see.
>
> Please take a moment to share this with the partner managed newsgroup lead
> team in the Partner Feedback newsgroup:
> For NNTP readers: Microsoft.private.directaccess.partnerfeedback
> For web interface: Partner Feedback
> We will ensure your thoughts and requests are routed to the appropriate
> product group.
>
> If you are interested in making your opinions count in a usability study,
> we conduct several types of studies on an ongoing basis from lab research
> on campus to survey and site visits. More information here:
>
http://www.microsoft.com/usability/enroll.mspx
>
> To provide your feedback directly to the product groups:
> https://mbs.microsoft.com/partnersource/productsuggestion
>
>
> Kind regards,
> Mike
>
> ======================================================
> PLEASE NOTE: The partner managed newsgroups are provided to assist with
> break/fix issues and simple how to questions.
> ======================================================
> We also love to hear your product feedback! Let us know what you think by
> posting from the web interface: Partner Feedback
> from your newsreader: microsoft.private.directaccess.partnerfeedback. We
> look forward to hearing from you!
> ======================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from this issue.
> ======================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
> ======================================================
>
>