Solved

Microsoft CRM 3.0 .Net Query Expression help

Posted on 2009-05-05
2
803 Views
Last Modified: 2013-11-07
Hi there,
I am developing a CRM 3.0 Callout in VB.net that uses a service.retrievemultiple statement that will retrieve the list of CRM 3.0 system users who own the contacts that a marketing campaign email or letter has been sent to.

I am after some assistance with the query expression, I have created what i think is the correct Advanced Find in the CRM interface as a sanity check that the general concept works but translating this into the query expression has me a little lost.

The Advanced find for the query would be as follows:
Look For: Users
Contacts (owners)
     Activity Parties(party)
             Activity(E-Mail)
                     Subject   Equals    XXXXX(Search Term)XXXXX

Is there anyone who knows enough to translate this search into a retirevemultiple query or could point me in the right direction?

Alistair
0
Comment
Question by:r0t0rua
2 Comments
 
LVL 11

Accepted Solution

by:
rakeshAgarwal earned 500 total points
ID: 24311488
Hi

 You have to use concept of link entity  here. I am pasting code snippet from one of  SDK codes provided by microsoft


                        // Create the ConditionExpression.
                        ConditionExpression condition = new ConditionExpression();

                        // Set the condition for the retrieval to be when the last name of the account's owner is not Cannon.
                        condition.AttributeName = "partyid";
                        condition.Operator = ConditionOperator.Equal;
                        condition.Values = new string [] {user.UserId.ToString()};

                        // Build the filter based on the condition.
                        FilterExpression filter = new FilterExpression();
                        filter.FilterOperator = LogicalOperator.And;
                        filter.Conditions = new ConditionExpression[] {condition};

LinkEntity link = new LinkEntity();

                        // Set the properties of the LinkEntity.
                        link.LinkCriteria = filter;

                        // Set the linking entity to be the activity.
                        link.LinkFromEntityName = EntityName.activitypointer.ToString();

                        // Set the attribute being linked to to be the activityid.
                        link.LinkFromAttributeName = "activityid";

                        // Set the entity being linked to to be the activityparty.
                        link.LinkToEntityName = EntityName.activityparty.ToString();
                  
                        // Set the attribute linking to the activityparty to be the activityid.
                        link.LinkToAttributeName = "activityid";
                  
                        // Create the query.
                        QueryExpression query = new QueryExpression();

                        // Set the properties of the query.
                        query.EntityName = EntityName.activitypointer.ToString();
                        query.ColumnSet = new AllColumns();
                        query.LinkEntities = new LinkEntity[] {link};


 I think there is a tool in stunnware.com.

regards
Rakesh Agarwal  

0
 

Author Comment

by:r0t0rua
ID: 24312701
Thanks for the SDK snippet, I already had the sample code as my base.  The real gem you supplied was the www.stunnware.com link which lead me to the FetchXML tool he has developed that generates the .Net query from a very easy to use GUI

http://www.stunnware.com/crm2/topic.aspx?id=FindingData6
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now