Selecting attributes to return in an enumeration

In this post I show how to select specific attributes to return during an enumeration.  The purpose of this feature is to limit sending extra data over the wire.  This is an optional extension we added to WS-Enumeration for convenience.  You do not need to use this feature to use our enumeration endpoint.

Consider that you are building a list view of Person objects.  To build this list you need two or three attribute values: ObjectID, DisplayName, and maybe Title.  Using enumerate normally you would get back every attribute on the person.  It could be particularly excessive if the person has a photo uploaded.  With the selection feature you can ask enumerate to return only ObjectID, DisplayName, and Title.  If the user selects a person in the list view, you can then get all of the attributes using WS-Transfer Get.

How does it work?  Add one rm:Selection element to wsen:Enumerate in the Enumerate request for each attribute you wish to “select.”  If an rm:Selection element is not present, the Enumerate operation returns all attributes as normal.  If an rm:Selection element is present, the Enumerate operation only returns the attributes included in rm:Selection elements.

Here’s an example of selecting only the DisplayName and ObjectID of person objects:

<?xml version = "1.0" encoding ="utf-8"?>
<s:Envelope xmlns:s = "">
        <a:Action s:mustUnderstand = "1" xmlns:a =""></ a:Action >
        <Enumerate xmlns = "">
            <Filter Dialect = "">/Person</ Filter>
            <MaxElements> 20</MaxElements>
            <MaxCharacters> 3668672</MaxCharacters>
            <Selection xmlns = "">DisplayName</ Selection>
            <Selection xmlns = "">ObjectID</ Selection>

Please note you can also sort by attributes.  Similar to rm:Selection, just add an rm:Sorting element to rm:Enumerate.  Rather than paste a one-off example below, allow me to point you to a collection of examples from a recent build of SOAP messages (the Topic 5 zip):

These are actual SOAP messages I picked off the wire of build 2313 (a build well after RC).  I cannot guarantee anything about these messages.

Hope this helps, and good luck exploring!

Comments (3)
  1. Paolo Tedesco says:

    Hi Joe,

    apart from looking at the sample soap messages, is there a way I can find out what are the possible elements of an Enumerate request?



  2. Joe Schulman says:


    The three best options right now are reading the SDK available from, looking at the public sample client code, or downloading the sample messages.  The code and sample messages are available from the MSDN code gallery link.


Comments are closed.

Skip to main content