<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Trace.WriteLine(_blogTitle); &#187; HowTo</title> <atom:link href="http://www.langalaxy.de/tag/howto/feed/" rel="self" type="application/rss+xml" /><link>http://www.langalaxy.de</link> <description>Random output</description> <lastBuildDate>Fri, 28 Oct 2011 17:20:03 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Howto: extend the maximum value for duration attributes</title><link>http://www.langalaxy.de/2011/01/howto-extend-the-maximum-value-for-duration-attributes/</link> <comments>http://www.langalaxy.de/2011/01/howto-extend-the-maximum-value-for-duration-attributes/#comments</comments> <pubDate>Mon, 17 Jan 2011 21:21:35 +0000</pubDate> <dc:creator>ckeller</dc:creator> <category><![CDATA[Dynamics CRM]]></category> <category><![CDATA[CRM 4]]></category> <category><![CDATA[HowTo]]></category><guid
isPermaLink="false">http://www.langalaxy.de/?p=450</guid> <description><![CDATA[If you have ever tried to enter a duration of more than 10 days for a service activity you would have seen that the system won&#8217;t accept this value. The duration of the appointment is invalid If you need to change the maximum value you are able to do this directly in the database (which [...]]]></description> <content:encoded><![CDATA[<p>If you have ever tried to enter a duration of more than 10 days for a service activity you would have seen that the system won&#8217;t accept this value.</p><blockquote><p>The duration of the appointment is invalid</p></blockquote><p>If you need to change the maximum value you are able to do this directly in the database (which is officially supported &#8211; quote of a support ticket below).</p><blockquote><ul><li>There is no way to modify the limit for service duration via UI. We will read this value from a SQL table and there we can change the default setting.</p><p>Database: [Organization]_MSCRM</p><p>Table: OrganizationBase</p><p>Field: MaxAppointmentDurationDays</p><p>Default value: 10</li><li>If you overwrite this value with the needed one (for example 20) and after that perform an IISReset, the known error message (&#8220;The duration of the appointment is invalid&#8221;) will no longer occur.<p>This change is the recommended solution from Microsoft CRM Support and will be supported.</li><li>Background: This field does come originally from CRM 3.0, where customer already provided feedback that the maximum duration of 10 days does not meet their need. The solution for CRM 3.0 was a solution implementation via registry key: Navigate to the following registry hive: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM. Create a registry key of type DWORD and name it &#8220;SchedulingEngine.MaxAppointmentDurationDays&#8221;. Provide a reasonable digit greater than 10 representing the number of days the service activity would be kept open and insure that the value is set to Decimal and not Hexadecimal. Now you can schedule an appointment with a duration value of more than 10 days.</li><li>For CRM 4.0 you will need a manual change of the according OrganisationBase entry. Exception: If you upgrade your CRM installation from CRM 3.0 to CRM4.0, the value will be automatically carried over</li></ul></blockquote><p>Another possibility to adjust this setting is to change the <a
href="http://msdn.microsoft.com/en-us/library/cc153634.aspx">organization.maxappointmentdurationdays Property</a> via the sdk.</p> ]]></content:encoded> <wfw:commentRss>http://www.langalaxy.de/2011/01/howto-extend-the-maximum-value-for-duration-attributes/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Howto: Use pre-generated Guids for records</title><link>http://www.langalaxy.de/2010/06/howto-use-pre-generated-guids-for-records/</link> <comments>http://www.langalaxy.de/2010/06/howto-use-pre-generated-guids-for-records/#comments</comments> <pubDate>Sat, 05 Jun 2010 13:00:53 +0000</pubDate> <dc:creator>ckeller</dc:creator> <category><![CDATA[Dynamics CRM]]></category> <category><![CDATA[CRM 4]]></category> <category><![CDATA[HowTo]]></category> <category><![CDATA[Plugins]]></category><guid
isPermaLink="false">http://www.langalaxy.de/?p=433</guid> <description><![CDATA[A customer asked me recently if it is possible to get the id of a record in a pre-create plugin. By default, it is not possible because the record is not yet created at this point and has not got an id. However, Dynamics CRM allows you to create your own id for a record. [...]]]></description> <content:encoded><![CDATA[<p>A customer asked me recently if it is possible to get the id of a record in a pre-create plugin. By default, it is not possible because the record is not yet created at this point and has not got an id.</p><p>However, Dynamics CRM allows you to create your own id for a record. The primary key of a record is stored in its <a
href="http://msdn.microsoft.com/en-us/library/bb959605(v=MSDN.10).aspx">Key-Property</a>. On all default entities, for example account, the id property is marked as <em><strong>Valid for create</strong></em> (see <a
href="http://msdn.microsoft.com/en-us/library/cc151315(v=MSDN.10).aspx">accountid</a>). This means, the sdk allows you to pass your own id.</p><div
class="wp_syntax"><div
class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.Crm.Sdk</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> PreCreateKeyPlugin
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> PreCreateKeyPlugin <span style="color: #008000;">:</span> IPlugin
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> Execute<span style="color: #008000;">&#40;</span>IPluginExecutionContext context<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>IsPreCreate<span style="color: #008000;">&#40;</span>context<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>context<span style="color: #008000;">.</span><span style="color: #0000FF;">InputParameters</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span>ParameterName<span style="color: #008000;">.</span><span style="color: #0000FF;">Target</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    DynamicEntity target <span style="color: #008000;">=</span> context<span style="color: #008000;">.</span><span style="color: #0000FF;">InputParameters</span><span style="color: #008000;">&#91;</span>ParameterName<span style="color: #008000;">.</span><span style="color: #0000FF;">Target</span><span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">as</span> DynamicEntity<span style="color: #008000;">;</span>
&nbsp;
                    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>target <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#123;</span>
                        Guid customId <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Guid<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;{d7256b93-a5b5-45f9-9f2d-a1838279c35c}&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                        target<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;accountid&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Key<span style="color: #008000;">&#40;</span>customId<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #008000;">&#125;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">bool</span> IsPreCreate<span style="color: #008000;">&#40;</span>IPluginExecutionContext context<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span>  context<span style="color: #008000;">.</span><span style="color: #0000FF;">MessageName</span> <span style="color: #008000;">==</span> MessageName<span style="color: #008000;">.</span><span style="color: #0000FF;">Create</span> <span style="color: #008000;">&amp;&amp;</span> 
                    context<span style="color: #008000;">.</span><span style="color: #0000FF;">Stage</span> <span style="color: #008000;">==</span> MessageProcessingStage<span style="color: #008000;">.</span><span style="color: #0000FF;">BeforeMainOperationOutsideTransaction</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div><p>If you register this plugin for pre-create on the account entity and create a new account, it will have the provided id.<br
/> <a
href="http://www.langalaxy.de/wp-content/uploads/2010/06/account.png"><img
src="http://www.langalaxy.de/wp-content/uploads/2010/06/account-300x74.png" alt="" title="Account" width="300" height="74" class="aligncenter size-medium wp-image-442" /></a></p><p>Please keep in mind, that you are in the responsibility to assign an new GUID for every execution of this plugin, but this should be clear when working with primary keys.</p> ]]></content:encoded> <wfw:commentRss>http://www.langalaxy.de/2010/06/howto-use-pre-generated-guids-for-records/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Howto: Get label for an attribute with JavaScript</title><link>http://www.langalaxy.de/2010/05/howto-get-label-for-an-attribute-with-javascript/</link> <comments>http://www.langalaxy.de/2010/05/howto-get-label-for-an-attribute-with-javascript/#comments</comments> <pubDate>Wed, 19 May 2010 19:49:23 +0000</pubDate> <dc:creator>ckeller</dc:creator> <category><![CDATA[Dynamics CRM]]></category> <category><![CDATA[CRM 4]]></category> <category><![CDATA[Form Scripting]]></category> <category><![CDATA[HowTo]]></category> <category><![CDATA[Javascript]]></category><guid
isPermaLink="false">http://www.langalaxy.de/?p=429</guid> <description><![CDATA[If you have to retrieve the label of an attribute in a form script, you have two options. The first one, is of course not supported, but quick and easy to implement. function GetFieldLabel&#40;fieldname&#41; &#123; var field = crmForm.all&#91;fieldname+ '_c'&#93;; &#160; if &#40;field != null&#41;&#123; return field.firstChild.firstChild.nodeValue; &#125; else &#123; return ''; &#125; &#125; &#160; [...]]]></description> <content:encoded><![CDATA[<p>If you have to retrieve the label of an attribute in a form script, you have two options. The first one, is of course not supported, but quick and easy to implement.</p><div
class="wp_syntax"><div
class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> GetFieldLabel<span style="color: #009900;">&#40;</span>fieldname<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> field <span style="color: #339933;">=</span> crmForm.<span style="color: #660066;">all</span><span style="color: #009900;">&#91;</span>fieldname<span style="color: #339933;">+</span> <span style="color: #3366CC;">'_c'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>field <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> field.<span style="color: #660066;">firstChild</span>.<span style="color: #660066;">firstChild</span>.<span style="color: #660066;">nodeValue</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>GetFieldLabel<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'subject'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>The other option is, to retrieve the label for the user language from the crm service. I will cover this in another article.</p> ]]></content:encoded> <wfw:commentRss>http://www.langalaxy.de/2010/05/howto-get-label-for-an-attribute-with-javascript/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Howto: Detect external request with JavaScript</title><link>http://www.langalaxy.de/2010/05/howto-detect-external-request-with-javascript/</link> <comments>http://www.langalaxy.de/2010/05/howto-detect-external-request-with-javascript/#comments</comments> <pubDate>Fri, 30 Apr 2010 22:19:50 +0000</pubDate> <dc:creator>ckeller</dc:creator> <category><![CDATA[Dynamics CRM]]></category> <category><![CDATA[CRM 4]]></category> <category><![CDATA[Form Scripting]]></category> <category><![CDATA[HowTo]]></category> <category><![CDATA[Javascript]]></category><guid
isPermaLink="false">http://www.langalaxy.de/?p=406</guid> <description><![CDATA[If you have activated Internet Facing Deployment for your CRM system, it could be necessary to detect if a request comes from outside your network or from your internal network. For example, if you integrate a web application with an IFrame, you have to set different addresses for internal and external access. Or, if the [...]]]></description> <content:encoded><![CDATA[<p>If you have activated Internet Facing Deployment for your CRM system, it could be necessary to detect if a request comes from outside your network or from your internal network.</p><p>For example, if you integrate a web application with an IFrame, you have to set different addresses for internal and external access. Or, if the application is only accessible from inside your network, you can show a message that it is not available for external users.</p><p>With help of Form Scripting you can detect an external request with little effort. You can make use of the function <a
href="http://msdn.microsoft.com/en-us/library/cc905758.aspx">prependOrgName(&#8221;)</a> which adds the organization prefix to the argument, if it is necessary. That means for an external request, it returns always the argument which you have passed.</p><div
class="wp_syntax"><div
class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> IsExternalRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> ifdTestValue <span style="color: #339933;">=</span> prependOrgName<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> isIFDCall <span style="color: #339933;">=</span> ifdTestValue <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">return</span> isIFDCall<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>Calling <code>IsExternalRequest</code> will return true, if the request comes from an external network range. You could also define this function globally in the form context (see also <a
href="http://www.stunnware.com/crm2/topic.aspx?id=JS5">http://www.stunnware.com/crm2/topic.aspx?id=JS5</a>)</p><div
class="wp_syntax"><div
class="code"><pre class="javascript" style="font-family:monospace;">IsExternalRequest <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> ifdTestValue <span style="color: #339933;">=</span> prependOrgName<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> isIFDCall <span style="color: #339933;">=</span> ifdTestValue <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">return</span> isIFDCall<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>]]></content:encoded> <wfw:commentRss>http://www.langalaxy.de/2010/05/howto-detect-external-request-with-javascript/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Howto: Debugging CRM errors</title><link>http://www.langalaxy.de/2009/08/howto-debugging-crm-errors/</link> <comments>http://www.langalaxy.de/2009/08/howto-debugging-crm-errors/#comments</comments> <pubDate>Mon, 24 Aug 2009 19:03:27 +0000</pubDate> <dc:creator>ckeller</dc:creator> <category><![CDATA[Dynamics CRM]]></category> <category><![CDATA[Debugging]]></category> <category><![CDATA[HowTo]]></category> <category><![CDATA[Support]]></category> <category><![CDATA[Tracing]]></category><guid
isPermaLink="false">http://www.langalaxy.de/?p=200</guid> <description><![CDATA[Today I had a service call with a customer who got an error on creating appointments. The error message was General Failure in Scheduling Engine A quick search in the internet revealed that this error message is not an unknown one (at least for Dynamics CRM 3) http://ronaldlemmen.blogspot.com/2007/05/error-when-creating-new-appointment.html http://support.microsoft.com/default.aspx/kb/917010/en-us Because the description of the articles [...]]]></description> <content:encoded><![CDATA[<p>Today I had a service call with a customer who got an error on creating appointments. The error message was <em>General Failure in Scheduling Engine</em></p><p>A quick search in the internet revealed that this error message is not an unknown one (at least for Dynamics CRM 3)</p><ul><li><a
href="http://ronaldlemmen.blogspot.com/2007/05/error-when-creating-new-appointment.html">http://ronaldlemmen.blogspot.com/2007/05/error-when-creating-new-appointment.html</a></li><li><a
href="http://support.microsoft.com/default.aspx/kb/917010/en-us">http://support.microsoft.com/default.aspx/kb/917010/en-us</a></li></ul><p>Because the description of the articles were not suitable for the customers environment and the CRM system is a newer one ( Dynamics CRM 4), we had to dig further.</p><p>We enabled the tracing on the crm application server and set the TraceCategories to *:Error which writes only the message with TraceLevel  Error to the trace file.</p><p>The generated trace file contained following error<br
/> <code>...<br
/> Crm Exception: Message: SecLib::CrmCheckPrivilege failed. Returned hr = -2147220960 on UserId: bcf9bb2e-6070-de11-a4a6-000c29abeb6c and PrivilegeId: b5f2ee06-d359-4495-bbda-312aae1c6b1e, ErrorCode: -2147220960<br
/> ...<br
/> MessageProcessor fail to process message 'Book' for 'appointment'.<br
/> ...<br
/> </code></p><p>A quick search for the name of the denied privilege showed that the security role of the user doesn&#8217;t give him the right to share appointments. Apparently, this right is needed for <em>creating</em> an appointment. After adjusting the security role the error was gone and the customer was happy.</p> ]]></content:encoded> <wfw:commentRss>http://www.langalaxy.de/2009/08/howto-debugging-crm-errors/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Howto: Retrieve members of a marketing list</title><link>http://www.langalaxy.de/2009/07/howto-retrieve-members-of-a-marketing-list/</link> <comments>http://www.langalaxy.de/2009/07/howto-retrieve-members-of-a-marketing-list/#comments</comments> <pubDate>Thu, 16 Jul 2009 16:43:35 +0000</pubDate> <dc:creator>ckeller</dc:creator> <category><![CDATA[Dynamics CRM]]></category> <category><![CDATA[CRM 4]]></category> <category><![CDATA[en]]></category> <category><![CDATA[Hints]]></category> <category><![CDATA[HowTo]]></category> <category><![CDATA[Marketing]]></category> <category><![CDATA[SDK]]></category><guid
isPermaLink="false">http://www.langalaxy.de/?p=153</guid> <description><![CDATA[Retrieving the members of a marketing list is for one reason a little bit trickier than retrieving other entities: there are no messages for operating with the listmember entity. Once you have loaded the marketing list, for which you want to retrieve the members, you have to find out of what type the members are. [...]]]></description> <content:encoded><![CDATA[<p>Retrieving the members of a marketing list is for one reason a little bit trickier than retrieving other entities: there are no messages for operating with the <a
title="listmember" href="http://msdn.microsoft.com/de-de/library/bb957095(en-us).aspx">listmember</a> entity.</p><p>Once you have loaded the marketing list, for which you want to retrieve the members, you have to find out of what type the members are. The type of the members is stored in the <a
title ="membertype" href="http://msdn.microsoft.com/de-de/library/cc153303(en-us).aspx">membertype</a> property of the marketing list.</p><p>Following method returns the name of the member entity type</p><div
class="wp_syntax"><div
class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">internal</span> <span style="color: #6666cc; font-weight: bold;">string</span> GetMemberType<span style="color: #008000;">&#40;</span>CrmNumber crmNumber<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">switch</span> <span style="color: #008000;">&#40;</span>crmNumber<span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">case</span> ListType<span style="color: #008000;">.</span><span style="color: #0000FF;">Account</span><span style="color: #008000;">:</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> EntityName<span style="color: #008000;">.</span><span style="color: #0000FF;">account</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">case</span> ListType<span style="color: #008000;">.</span><span style="color: #0000FF;">Contact</span><span style="color: #008000;">:</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> EntityName<span style="color: #008000;">.</span><span style="color: #0000FF;">contact</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">case</span> ListType<span style="color: #008000;">.</span><span style="color: #0000FF;">Lead</span><span style="color: #008000;">:</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> EntityName<span style="color: #008000;">.</span><span style="color: #0000FF;">lead</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">default</span><span style="color: #008000;">:</span>
            <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div><p>With this information we can create the <a
href="http://msdn.microsoft.com/de-de/library/bb929258(en-us).aspx">query expression</a> which we use to retrieve the list members.</p><div
class="wp_syntax"><div
class="code"><pre class="csharp" style="font-family:monospace;">BusinessEntityCollection RetrieveMembers<span style="color: #008000;">&#40;</span>list marketinglist<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
&nbsp;
 <span style="color: #6666cc; font-weight: bold;">string</span> targetEntity <span style="color: #008000;">=</span> GetMemberType<span style="color: #008000;">&#40;</span>marketinglist<span style="color: #008000;">.</span><span style="color: #0000FF;">membertype</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
 QueryExpression query <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> QueryExpression
 <span style="color: #008000;">&#123;</span>
   EntityName <span style="color: #008000;">=</span> targetEntity<span style="color: #008000;">;</span>
   ColumnSet <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> AllColumns<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
 <span style="color: #008080; font-style: italic;">// link from target entity to listmember</span>
 LinkEntity linkToListMemberEntity <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LinkEntity
 <span style="color: #008000;">&#123;</span>
   LinkFromEntityName <span style="color: #008000;">=</span> EntityName<span style="color: #008000;">.</span><span style="color: #0000FF;">account</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
   LinkFromAttributeName <span style="color: #008000;">=</span> targetEntity <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;id&quot;</span><span style="color: #008000;">;</span>
   LinkToEntityName <span style="color: #008000;">=</span> EntityName<span style="color: #008000;">.</span><span style="color: #0000FF;">listmember</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
   LinkToAttributeName <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;entityid&quot;</span><span style="color: #008000;">;</span>
 <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
 <span style="color: #008080; font-style: italic;">//link from listmember to list</span>
 LinkEntity linkToMarketingList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LinkEntity
 <span style="color: #008000;">&#123;</span>
   LinkFromEntityName <span style="color: #008000;">=</span> EntityName<span style="color: #008000;">.</span><span style="color: #0000FF;">listmember</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
   LinkFromAttributeName <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;listid&quot;</span><span style="color: #008000;">;</span>
   LinkToEntityName <span style="color: #008000;">=</span> EntityName<span style="color: #008000;">.</span><span style="color: #0000FF;">list</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
   LinkToAttributeName <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;listid&quot;</span><span style="color: #008000;">;</span>
 <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
 <span style="color: #008080; font-style: italic;">// filter result with the id of the marketing list</span>
 ConditionExpression marketingListIdCondition <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ConditionExpression
 <span style="color: #008000;">&#123;</span>
   AttributeName <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;listid&quot;</span><span style="color: #008000;">;</span>
   <span style="color: #0600FF; font-weight: bold;">Operator</span> <span style="color: #008000;">=</span> ConditionOperator<span style="color: #008000;">.</span><span style="color: #0000FF;">Equal</span><span style="color: #008000;">;</span>
   Values <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#123;</span> marketinglist<span style="color: #008000;">.</span><span style="color: #0000FF;">listid</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span> <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
 <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
 linkToMarketingList<span style="color: #008000;">.</span><span style="color: #0000FF;">LinkCriteria</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> FilterExpression<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 linkToMarketingList<span style="color: #008000;">.</span><span style="color: #0000FF;">LinkCriteria</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Conditions</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>marketingListIdCondition<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
 linkToListMemberEntity<span style="color: #008000;">.</span><span style="color: #0000FF;">LinkEntities</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>linkToMarketingList<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
 query<span style="color: #008000;">.</span><span style="color: #0000FF;">LinkEntities</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>linkToListMemberEntity<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
 BusinessEntityCollection members <span style="color: #008000;">=</span> service<span style="color: #008000;">.</span><span style="color: #0000FF;">RetrieveMultiple</span><span style="color: #008000;">&#40;</span>query<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
 <span style="color: #0600FF; font-weight: bold;">return</span> members<span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>]]></content:encoded> <wfw:commentRss>http://www.langalaxy.de/2009/07/howto-retrieve-members-of-a-marketing-list/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Object Caching 436/534 objects using disk: basic

Served from: www.langalaxy.de @ 2012-02-07 02:52:42 -->
