Static void main (string [] ARGs)
{
Servicepointmanager. servercertificatevalidationcallback = (sender, certificate, chain, errors) => true;
Const string id = "consumer ";
String bufferstring = getobjectidstringfromuid (ID );
VaR service = new exchangeservicebinding
{
Url = "https // w2k3x64/EWS/exchange. asmx ",
Credentials = new networkcredential ("Bob", "password! "," Contoso "),
Requestserverversionvalue = new requestserverversion {version = exchangeversiontype. exchange2007_sp1}
};
VaR response = service. finditem (New finditemtype
{
Parentfolderids = new [] {New distinguishedfolderidtype {id = distinguishedfolderidnametype. Calendar }},
Itemshape = new itemresponseshapetype
{
Baseshape = defaultshapenamestype. allproperties,
},
Restriction = new restrictiontype {
Item = new isequaltotype
{
Item = new pathtoextendedfieldtype
{
Distinguishedpropertysetid = distinguishedpropertysettype. Meeting,
Distinguishedpropertysetidspecified = true,
Propertyid = 0x03,
Propertyidspecified = true,
Propertytype = mapipropertytypetype. Binary
},
Fielduriorconstant = new fielduriorconstanttype
{
Item = new constantvaluetype
{
Value = bufferstring
}
}
}
}
});
VaR messagetype = (finditemresponsemessagetype) response. responsemessages. items [0]);
Console. Out. writeline ("messagetype. responseclass = {0}", messagetype. responseclass );
If (messagetype. responseclass! = Responseclasstype. Success)
{
Console. Out. writeline (messagetype. messagetext );
Return;
}
VaR returneditems = messagetype. rootfolder. item as arrayofrealitemstype;
If (returneditems = NULL | returneditems. Items = NULL)
{
Console. Out. writeline ("nothing found .");
Return;
}
Foreach (calendaritemtype item in returneditems. Items)
{
Console. Out. writeline ("item. Subject = {0}", item. Subject );
Console. Out. writeline ("item. uid = {0}", item. UID );
}
Console. Readline ();
}
Private Static string getobjectidstringfromuid (string ID)
{
VaR buffer = new byte [ID. Length/2];
For (INT I = 0; I <ID. Length/2; I ++)
{
VaR hexvalue = byte. parse (Id. substring (I * 2, 2), numberstyles. allowhexspecifier );
Buffer [I] = hexvalue;
}
Return convert. tobase64string (buffer );
}