Hi
I'm trying to build a simple console app as a POC to pull all calendar items for my personal calendar. Firstly, the documentation from MS is p!ss poor, and the little code snippets i've been able to find don't seem to help.
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Starting Query...");
var startTime = DateTime.Now;
var esb = new ExchangeServiceBinding();
esb.Credentials = CredentialCache.DefaultCredentials;
var fit = new FindItemType();
fit.ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.Default };
var path = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.itemSubject };
fit.ItemShape.AdditionalProperties = new PathToUnindexedFieldType[1] { path };
fit.ParentFolderIds = new DistinguishedFolderIdType[]
{
new DistinguishedFolderIdType {
Mailbox = new EmailAddressType { EmailAddress="myemail@mydomain.com" },
Id = DistinguishedFolderIdNameType.calendar}
};
fit.Traversal = ItemQueryTraversalType.Shallow;
var firt = esb.FindItem(fit);
foreach (var item in firt.ResponseMessages.Items)
{
Console.WriteLine(item.MessageText);
}
var time = DateTime.Now.Subtract(startTime);
Console.WriteLine();
Console.WriteLine(String.Format("Finished in {0} milli seconds", time.Milliseconds));
Console.ReadLine();
}
}
This bombs on the web service call (var firt = esb.FindItem(fit);) - with the following error message:
Path property must be set before calling the Send method.
I can't seem to find any property to set to provide a path. Can anyone help out here?