Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

FetchXML Schema

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

The fetch XML parameter is used to create queries against the Microsoft Dynamics CRM 4.0 database. For more information, see Using FetchXML.

This schema can be found in the SDK download:

Server\Schemas\fetch.xsd
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="fetch" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:mstns="http://tempuri.org/fetch/unique">
   <xs:annotation>
      <xs:documentation>Schema name: fetch-schema</xs:documentation>
   </xs:annotation>
   <!--
   
      condition element - used for capturing entity and link-entity
                     "where" clause criteria
      
   -->
   <!-- [XDR-XSD] "value" element  -->
   <xs:element name="value" type="xs:string"></xs:element>
   <!-- [XDR-XSD] "condition" element  -->
   <xs:element name="condition">
      <xs:complexType>
         <xs:choice minOccurs="0" maxOccurs="unbounded">
            <!-- -->
            <!--
      The attribute "value" is used for all operators that compare to a single value (for example, eq).
      The element "value" is used for operators that compare to multiple values (for example, in).
      Some operators require neither the attribute "value" or the element "value" (for example, null).
   -->
            <xs:element ref="value" minOccurs="0" maxOccurs="unbounded" />
         </xs:choice>
         <!-- -->
         <xs:attribute name="attribute" use="required" type="xs:string"></xs:attribute>
         <xs:attribute name="operator" use="required" type="operator"></xs:attribute>
         <!--
      The attribute "value" is used for all operators that compare to against a single value (for example, eq).
      The element "value" is used for operators that compare to multiple values (for example, in).
      Some operators require neither the attribute "value" or the element "value" (for example, null).
   -->
         <xs:attribute name="value" type="xs:string"></xs:attribute>
         <xs:attribute name="aggregate">
            <xs:simpleType>
               <xs:restriction base="xs:NMTOKEN">
                  <xs:enumeration value="count" />
                  <xs:enumeration value="average" />
                  <xs:enumeration value="sum" />
                  <xs:enumeration value="stdev" />
               </xs:restriction>
            </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="alias" type="xs:string"></xs:attribute>
      </xs:complexType>
   </xs:element>
   <!--
   
      filter element - used for constructing complex conditionals
                   legal one entity and link-entity
      
   -->
   <!-- [XDR-XSD] "filter" element  -->
   <xs:element name="filter">
      <xs:complexType>
         <xs:choice minOccurs="0" maxOccurs="unbounded">
            <!-- -->
            <xs:element ref="condition" minOccurs="0" maxOccurs="unbounded" />
            <xs:element ref="filter" minOccurs="0" maxOccurs="unbounded" />
         </xs:choice>
         <!-- -->
         <xs:attribute name="type" default="and">
            <xs:simpleType>
               <xs:restriction base="xs:NMTOKEN">
                  <xs:enumeration value="and" />
                  <xs:enumeration value="or" />
               </xs:restriction>
            </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="isquickfindfields" type="xs:boolean" />
      </xs:complexType>
   </xs:element>
   <!--
   
      attribute elements - used for selecting attributes from the
                      surrounding entity / link-entity, these
                      values are returned as part of the fetch
      
   -->
   <!-- [XDR-XSD] "all-attributes" element  -->
   <xs:element name="all-attributes">
      <xs:complexType></xs:complexType>
   </xs:element>
   <!-- [XDR-XSD] "attribute" element  -->
   <xs:element name="attribute">
      <xs:complexType>         
         <xs:attribute name="name" use="required" type="xs:string"></xs:attribute>
         <xs:attribute name="build" type="build"></xs:attribute>
         <xs:attribute name="addedby" type="xs:string" />
      </xs:complexType>
   </xs:element>
   <!--
   
   order element - used to specify a sort order

   -->
   <!-- [XDR-XSD] "order" element  -->
   <xs:element name="order">
      <xs:complexType>
         <xs:choice minOccurs="0" maxOccurs="unbounded">
            <!-- --></xs:choice>
         <!-- -->
         <xs:attribute name="attribute" use="required" type="xs:string"></xs:attribute>
         <xs:attribute name="descending" default="false" type="xs:boolean"></xs:attribute>
      </xs:complexType>
   </xs:element>
   <!--
   
      link-entity element - used for joining one entity to its "parent"
      
   -->
   <!-- [XDR-XSD] "link-entity" element  -->
   <xs:element name="link-entity">
      <xs:complexType>
         <xs:choice minOccurs="0" maxOccurs="unbounded">
            <!-- -->
            <xs:element ref="all-attributes" minOccurs="0" />
            <xs:element ref="attribute" minOccurs="0" maxOccurs="unbounded" />
            <xs:element ref="order" minOccurs="0" maxOccurs="1" />
            <xs:element ref="filter" minOccurs="0" />
            <xs:element ref="link-entity" />
         </xs:choice>
         <!-- -->
         <xs:attribute name="name" use="required" type="xs:string"></xs:attribute>
         <xs:attribute name="to" type="xs:string"></xs:attribute>
         <xs:attribute name="from" type="xs:string"></xs:attribute>         
         <xs:attribute name="alias" type="xs:string"></xs:attribute>
         <xs:attribute name="link-type" type="xs:string"></xs:attribute>
         <xs:attribute name="visible" type="xs:boolean"></xs:attribute>
         <xs:attribute name="intersect" type="xs:boolean"></xs:attribute>
      </xs:complexType>
   </xs:element>
   <!--
   
      entity element - used for specifying the root element for a fetch, only
                   one root entity is allowed in a given fetch, all others
                   are dependent on this entity and are marked as
                   link-entity
      
   -->
   <!-- [XDR-XSD] "entity" element  -->
   <xs:element name="entity">
      <xs:complexType>
         <xs:choice minOccurs="0" maxOccurs="unbounded">
            <!-- -->
            <xs:element ref="all-attributes" minOccurs="0" />
            <xs:element ref="attribute" minOccurs="0" maxOccurs="unbounded" />
            <xs:element ref="order" minOccurs="0" maxOccurs="unbounded" />
            <xs:element ref="link-entity" />
            <xs:element ref="filter" minOccurs="0" />
         </xs:choice>
         <!-- -->
         <xs:attribute name="name" use="required" type="xs:string"></xs:attribute>
      </xs:complexType>
   </xs:element>
   <!--
   
      fetch element - root element for the query
      
   -->
   <!-- [XDR-XSD] "fetch" element  -->
   <xs:element name="fetch">
      <xs:complexType>
         <xs:choice minOccurs="0" maxOccurs="unbounded">
            <!-- -->
            <xs:element ref="entity" />
            <!-- This is for the Reports view only -->
            <xs:element ref="order" minOccurs="1" maxOccurs="1" />
         </xs:choice>
         <!-- -->
         <xs:attribute name="version" use="required"></xs:attribute>
         <xs:attribute name="count" type="xs:integer"></xs:attribute>
         <xs:attribute name="page" type="xs:integer"></xs:attribute>
         <xs:attribute name="utc-offset" type="IntOrEmpty"></xs:attribute>
         <xs:attribute name="aggregate" type="xs:boolean"></xs:attribute>
         <xs:attribute name="distinct" type="xs:boolean"/>
         <xs:attribute name="mapping">
            <xs:simpleType>
               <xs:restriction base="xs:NMTOKEN">
                  <xs:enumeration value="internal" />
                  <xs:enumeration value="logical" />
                  <xs:enumeration value="physical" />
                  <!-- This is for the Repoerts view only -->
                  <xs:enumeration value="bogus" />
               </xs:restriction>
            </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="output-format">
            <xs:simpleType>
               <xs:restriction base="xs:NMTOKEN">
                  <xs:enumeration value="xml-ado" />
                  <xs:enumeration value="xml-auto" />
                  <xs:enumeration value="xml-elements" />
                  <xs:enumeration value="xml-raw" />
                  <xs:enumeration value="xml-platform" />
               </xs:restriction>
            </xs:simpleType>
         </xs:attribute>
      </xs:complexType>
   </xs:element>
   <!-- [XDR-XSD] XDR datatype derivations -->
   <xs:element name="savedquery">
      <xs:complexType>
         <xs:all>
            <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" />
            <xs:element name="savedqueryid" type="guid" minOccurs="1" maxOccurs="1" />
            <xs:element name="returnedtypecode" type="SerializedInteger" minOccurs="1" maxOccurs="1" />
            <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="querytype" type="SerializedInteger" minOccurs="1" maxOccurs="1" />
            <xs:element name="iscustomizable" type="SerializedTrueFalse01Type" minOccurs="0" maxOccurs="1" />
              <xs:element name="isquickfindquery" type="SerializedTrueFalse01Type" minOccurs="0" maxOccurs="1" />
                <xs:element name="isuserdefined" type="SerializedTrueFalse01Type" minOccurs="0" maxOccurs="1" />
              <xs:element name="isdefault" type="SerializedTrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="isprivate" type="xs:boolean" minOccurs="0" maxOccurs="1" />
            <xs:element name="queryapi" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="fetchxml" minOccurs="0" maxOccurs="1">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element ref="fetch" minOccurs="0" maxOccurs="1" />
                  </xs:sequence>
               </xs:complexType>
            </xs:element>
            <xs:element name="columnsetxml" minOccurs="1" maxOccurs="1">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="columnset" minOccurs="0" maxOccurs="1">
                        <xs:complexType>
                           <xs:choice minOccurs="0" maxOccurs="unbounded">
                              <!-- Because <column> contains text and one attribute we cannot specify its type. We have to define it as a complexType with a simple content. -->
                              <xs:element name="column" minOccurs="0" maxOccurs="1">
                                 <xs:complexType>
                                    <xs:simpleContent>
                                       <xs:extension base="xs:string">
                                          <xs:attribute name="build" type="build" />
                                          <xs:attribute name="addedby" type="xs:string" />
                                       </xs:extension>
                                    </xs:simpleContent>
                                 </xs:complexType>
                              </xs:element>
                              <xs:choice>
                                 <xs:element name="ascend" minOccurs="0" maxOccurs="1" />
                                 <xs:element name="descend" minOccurs="0" maxOccurs="1" />
                              </xs:choice>
                              <xs:element name="filter" minOccurs="0" maxOccurs="1">
                              <!-- Allow support for v1.5 format -->
                                 <xs:complexType>
                                    <xs:sequence>
                                       <xs:element name="condition" minOccurs="1" maxOccurs="unbounded">
                                          <xs:complexType>
                                             <xs:attribute name="column" type="xs:string" use="required" />
                                             <xs:attribute name="operator" type="operator" use="optional" />
                                             <xs:attribute name="value" type="xs:string" use="optional"/>
                                          </xs:complexType>
                                       </xs:element>
                                    </xs:sequence>
                                    
                                    <xs:attribute name="column" type="xs:string" use="optional" />
                                    <xs:attribute name="operator" type="operator" use="optional" />
                                    <xs:attribute name="value" type="xs:string" use="optional"/>
                                    <xs:attribute name="type" type="xs:string" use="optional"/>
                                                                  
                                 </xs:complexType>
                              </xs:element>
                           </xs:choice>
                           <xs:attribute name="version"></xs:attribute>
                           <xs:attribute name="distinct" type="xs:boolean"/>
                        </xs:complexType>
                     </xs:element>
                  </xs:sequence>
               </xs:complexType>
            </xs:element>
            <xs:element name="layoutxml" minOccurs="1" maxOccurs="1">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="grid" minOccurs="1" maxOccurs="1">
                        <xs:complexType>
                           <xs:sequence>
                              <xs:element name="row" minOccurs="1" maxOccurs="1">
                                 <xs:complexType>
                                    <xs:sequence>
                                       <xs:element name="cell" minOccurs="1" maxOccurs="unbounded">
                                          <xs:complexType>
                                             <xs:sequence></xs:sequence>
                                             <xs:attribute name="name" type="xs:string" use="required" />
                                             <xs:attribute name="width" type="xs:integer" use="optional" />
                                             <xs:attribute name="LabelId" type="xs:string" use="optional" />
                                             <xs:attribute name="label" type="xs:string" use="optional" />
                                             <xs:attribute name="desc" type="xs:string" use="optional" />
                                             <xs:attribute name="ishidden" type="xs:integer" use="optional" />
                                             <xs:attribute name="disableSorting" type="xs:integer" use="optional" />
                                             <xs:attribute name="disableMetaDataBinding" type="xs:integer" use="optional" />
                                          </xs:complexType>
                                       </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="name" type="xs:string" use="required" />
                                    <xs:attribute name="id" type="xs:string" use="required" />
                                    <xs:attribute name="multiobjectidfield" type="xs:string" />
                                 </xs:complexType>
                              </xs:element>
                           </xs:sequence>
                           <xs:attribute name="name" type="xs:string" use="required" />
                           <xs:attribute name="select" type="xs:boolean" use="required" />
                           <xs:attribute name="preview" type="BoolOrEmpty" use="required" />
                           <xs:attribute name="icon" type="BoolOrEmpty" use="required" />
                           <xs:attribute name="jump" type="xs:string" use="optional" />
                           <xs:attribute name="object" type="xs:integer" use="required" />
                           <xs:attribute name="disableInlineEditing" type="xs:integer" use="optional" />
                        </xs:complexType>
                     </xs:element>
                  </xs:sequence>
               </xs:complexType>
            </xs:element>
         </xs:all>
         <xs:attribute name="donotuseinLCID" type="xs:string" use="optional" />
         <xs:attribute name="useinLCID" type="xs:string" use="optional" />
      </xs:complexType>
   </xs:element>   
   <xs:complexType name="SerializedInteger">
    <xs:simpleContent>
      <xs:extension base="xs:nonNegativeInteger">
        <xs:attribute name="formattedvalue" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
   <xs:simpleType name="build">
      <xs:restriction base="xs:string">
         <xs:enumeration value="1.504021" />
         <xs:enumeration value="1.003017" />
      </xs:restriction>
   </xs:simpleType>
   <xs:simpleType name="operator">
               <xs:restriction base="xs:NMTOKEN">
                  <xs:enumeration value="lt" />
                  <xs:enumeration value="gt" />
                  <xs:enumeration value="le" />
                  <xs:enumeration value="ge" />
                  <xs:enumeration value="eq" />
                  <xs:enumeration value="ne" />
                  <xs:enumeration value="neq" />
                  <xs:enumeration value="null" />
                  <xs:enumeration value="not-null" />
                  <xs:enumeration value="in" />
                  <xs:enumeration value="not-in" />
                  <xs:enumeration value="between" />
                  <xs:enumeration value="not-between" />
                  <xs:enumeration value="like" />
                  <xs:enumeration value="not-like" />
                  <xs:enumeration value="yesterday" />
                  <xs:enumeration value="today" />
                  <xs:enumeration value="tomorrow" />
                  <xs:enumeration value="next-seven-days" />
                  <xs:enumeration value="last-seven-days" />
                  <xs:enumeration value="next-week" />
                  <xs:enumeration value="last-week" />
                  <xs:enumeration value="this-month" />
                  <xs:enumeration value="last-month" />
                  <xs:enumeration value="next-month" />
                  <xs:enumeration value="on" />
                  <xs:enumeration value="on-or-before" />
                  <xs:enumeration value="on-or-after" />
                  <xs:enumeration value="this-year" />
                  <xs:enumeration value="last-year" />
                  <xs:enumeration value="next-year" />
                  <xs:enumeration value="eq-userid" />
                  <xs:enumeration value="ne-userid" />
                  <xs:enumeration value="eq-businessid" />
                  <xs:enumeration value="ne-businessid" />
                  <xs:enumeration value="this-week" />
                  <xs:enumeration value="last-x-months" />
                  <xs:enumeration value="eq-userlanguage" />   
               </xs:restriction>
            </xs:simpleType>
<xs:simpleType name="guid">
   <xs:restriction base="xs:string">
      <xs:pattern value="\{?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\}?" />
   </xs:restriction>
</xs:simpleType>
<xs:simpleType name="BoolOrEmpty">
   <xs:union memberTypes="xs:boolean">
      <xs:simpleType>
         <xs:restriction base="xs:string">
            <xs:enumeration value="" />
         </xs:restriction>
      </xs:simpleType>
   </xs:union>
</xs:simpleType>
<xs:simpleType name="IntOrEmpty">
   <xs:union memberTypes="xs:integer">
      <xs:simpleType>
         <xs:restriction base="xs:string">
            <xs:enumeration value="" />
         </xs:restriction>
      </xs:simpleType>
   </xs:union>
</xs:simpleType>
   <xs:simpleType name="TrueFalse01Type">
    <xs:restriction base="xs:string">
      <xs:enumeration value="0" />
      <xs:enumeration value="1" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SerializedTrueFalse01Type">
    <xs:simpleContent>
      <xs:extension base="TrueFalse01Type">
        <xs:attribute name="name" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
   </xs:complexType>
</xs:schema>

© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft. All rights reserved.