Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

FetchXML to get email CC email addresses

Posted on by Microsoft Employee

Hi, can anyone help me with a fetchXML query? I am getting a list of email message fields. the purpose is to display the actual to / from / cc / bcc email addresses in a form via a webresource.

I have the fetch XML working, but get activityparty: and a guid for cc and bcc.

my simplified (I've removed a couple of conditions)  fetchXML so far is:

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' >
  <entity name='email' >
    <attribute name='sender' />
    <attribute name='torecipients' />
    <attribute name='subject' />
    <attribute name='senton' />
    <attribute name='cc' />

  </entity>
</fetch>

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: FetchXML to get email CC email addresses

    in case anyone is interested, I have taken the approach of getting all the activity party records via fetch XML, then looping through them in JS to create strings for to, cc, bcc. slightly messy, but works and gives the user what the want.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: FetchXML to get email CC email addresses

    Hi Scott, thanks for the reply and sorry for the late one myself.

    With what I am trying to do - show the email addresses for the

    From

    to

    CC

    BCC

    I though using the email entity fields was correct, but as I found CC and BCC are not there.

    As I need to get CC addresses and probably the BCC as well, i'll just do a single fetchXML for CC (3) and BCC(4). To be more correct should I also get the To (2) and Sender (1) addresses from the activityparty entity or use the email.torecipients and email.sender fields still?

  • Suggested answer
    ScottDurow Profile Picture
    ScottDurow 50,177 on at
    RE: FetchXML to get email CC email addresses

    You will need to join to the Activity Party for CC participation type code to get the partyid:

    <fetch mapping="logical" output-format="xml-platform" version="1.0" distinct="true">

     <entity name="activitypointer">

       <attribute name="activitytypecode" />

       <attribute name="subject" />

       <attribute name="activityid" />

       <link-entity name="activityparty" to="activityid" from="activityid" alias="aa">

         <filter type="and">

           <condition value="3" attribute="participationtypemask" operator="eq" /> <!-- CC activity parties -->

         </filter>

           <attribute name="partyid"/>

           <attribute name='participationtypemask'/>

       </link-entity>

     </entity>

    </fetch>

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans