There are code examples in the SDK. The example you need would be found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/exsdkprogtasks/html/63af1f9c-464b-4fca-9ae3-3d60f24ca93c.asp. This example provides an object that contains an array of items found in the Inbox and Drafts folder. The linked example is out-of-date and will be replaced by the following code (Note: the proxy objects used by this code were generated in Visual Studio 2005. Different proxy generators may create different proxy objects).

static void Main()

{

ExchangeServiceBinding esb = new ExchangeServiceBinding();

esb.Credentials = new NetworkCredential("UserName", "Password", "Domain");

esb.Url = @"http://myexchangeserver.mydomain.com/EWS/Exchange.asmx";

// Form the FindItem request

FindItemType findItemRequest = new FindItemType();

findItemRequest.Traversal = ItemQueryTraversalType.Shallow;

// Define which item properties are returned in the response

ItemResponseShapeType itemProperties = new ItemResponseShapeType();

itemProperties.BaseShape = DefaultShapeNamesType.AllProperties;

// Add properties shape to request

findItemRequest.ItemShape = itemProperties;

// Identify which folders to search to find items

DistinguishedFolderIdType[] folderIDArray = new DistinguishedFolderIdType[2];

folderIDArray[0] = new DistinguishedFolderIdType();

folderIDArray[1] = new DistinguishedFolderIdType();

folderIDArray[0].Id = DistinguishedFolderIdNameType.inbox;

folderIDArray[1].Id = DistinguishedFolderIdNameType.drafts;

// Add folders to request

findItemRequest.ParentFolderIds = folderIDArray;

// Send the request and get the response

FindItemResponseType findItemResponse = esb.FindItem(findItemRequest);

}

The findItemResponse object contains the array of items found in the Inbox and Drafts folders. To review/debug the XML requests and responses, I will add the following code after the request is sent and the response is received:

// Create a text file in /bin/ with the request XML

using (StreamWriter myReqWriter = new StreamWriter("FindItemRequestFile.xml"))

{

XmlSerializer mySerializer = new XmlSerializer(typeof(FindItemType));

mySerializer.Serialize(myReqWriter, findItemRequest);

}

// Create a text file in /bin/ with the response XML

using (StreamWriter myRespWriter = new StreamWriter("FindItemResponseFile.xml"))

{

XmlSerializer mySerializer = new XmlSerializer(typeof(FindItemResponseType));

mySerializer.Serialize(myRespWriter, findItemResponse);

}

This will provide you with two files that contain the request and response XML.

I hope this information helps you.