title: How to obtain members of a marketing list using QueryExpression object?
body: <p>I'm using <em>QueryExpression</em> often but this far, it's been a straigh-forward get-this-from-that or put-this-in-that. Recently, I learned that there's something called <em>LinkedEntity</em> and I started looking for it. As an example I got inspired by a related question here on SO and I started to create an expression for getting all the members of a list given it's guid.</p>
  
  <p>All the examples I've found follow the same pattern, though - as <a href="http://community.dynamics.com/product/crm/crmtechnical/b/crminogic/archive/2009/05/04/retrieve-marketing-list-members.aspx" rel="nofollow noreferrer">this example</a> illustrates. From <a href="https://stackoverflow.com/questions/14315073/what-should-be-used-instead-of-the-deprecated-entityname-account-tostring">this question</a>, I've learned that it's an obsolete approach (CRM 4.0). I've failed founding a more up-to-date example and I'm not sure how to design the linkage.</p>
  
  <p>Anybody cares to provide a sample code?</p>
  
  <pre class="lang-csharp prettyprint-override"><code>Guid guid = ...;
  QueryExpression request = new QueryExpression
  {
    EntityName = "account",
    ColumnSet = new ColumnSet(true),
    LinkEntities= ???,                        // How to link the entities correctly?
    Criteria = new FilterExpression { ??? }   // How to filter for *guid* only?
  };
  </code></pre>
  
  <p>I've created a fetch-XML linking two entities but I'm not clear on how to translate it to <em>QueryExpression</em> entity. I've got something like this. Any suggestions?</p>
  
  <pre class="lang-csharp prettyprint-override"><code>LinkEntity linkListToMember = new LinkEntity(
    "list", "listmember", "listid", "listid", JoinOperator.Natural);
  LinkEntity linkMemberToContact = new LinkEntity(
    "listmember", "account", "entityid", "accountid", JoinOperator.Natural);
  </code></pre>