动态 - 如何获取特定用户通过Web Api参加的所有约会

时间:2017-09-06 10:51:22

标签: dynamics-crm dynamics-crm-webapi

在Dynamics CRM中,我尝试使用Web API获取特定用户作为与会者的所有约会。我知道我必须使用activitypartytypemask等于9处理约会实体和ActivityParty,但实际上无法弄清楚如何制作它。如何识别与会者?

1 个答案:

答案 0 :(得分:0)

您可以将FetchXml用于您的目的。检查以下获取:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
  <entity name="appointment">
    <attribute name="subject" />
    <attribute name="statecode" />
    <attribute name="scheduledstart" />
    <attribute name="scheduledend" />
    <attribute name="regardingobjectid" />
    <attribute name="activityid" />
    <link-entity name="activityparty" from="activityid" to="activityid" alias="aa">
      <filter type="and">
        <condition attribute="participationtypemask" operator="in">
          <value>6</value>
          <value>5</value>
        </condition>
        <condition attribute="partyid" operator="eq" value="{9CE2BF21-408B-E611-80F3-C4346BAC7ABC}" />
      </filter>
    </link-entity>
  </entity>
</fetch>

使用提供的FetchXml和WebApi,您应该得到您想要的结果。网址应如下所示:

[Server Base Url]/api/data/v8.2/appointments?fetchXml=%3Cfetch%20version%3D%221.0%22%20output-format%3D%22xml-platform%22%20mapping%3D%22logical%22%20distinct%3D%22true%22%3E%3Centity%20name%3D%22appointment%22%3E%3Cattribute%20name%3D%22subject%22%20%2F%3E%3Cattribute%20name%3D%22statecode%22%20%2F%3E%3Cattribute%20name%3D%22scheduledstart%22%20%2F%3E%3Cattribute%20name%3D%22scheduledend%22%20%2F%3E%3Cattribute%20name%3D%22regardingobjectid%22%20%2F%3E%3Cattribute%20name%3D%22activityid%22%20%2F%3E%3Clink-entity%20name%3D%22activityparty%22%20from%3D%22activityid%22%20to%3D%22activityid%22%20alias%3D%22aa%22%3E%3Cfilter%20type%3D%22and%22%3E%3Ccondition%20attribute%3D%22participationtypemask%22%20operator%3D%22in%22%3E%3Cvalue%3E6%3C%2Fvalue%3E%3Cvalue%3E5%3C%2Fvalue%3E%3C%2Fcondition%3E%3Ccondition%20attribute%3D%22partyid%22%20operator%3D%22eq%22%20value%3D%22%7B9CE2BF21-408B-E611-80F3-C4346BAC7ABC%7D%22%20%2F%3E%3C%2Ffilter%3E%3C%2Flink-entity%3E%3C%2Fentity%3E%3C%2Ffetch%3E

This article包含其他详细信息。