Free Support Forum - aspose.com

How to filter appointments to include those that have a recurrence on a date

I am using the ExchangeQueryBuilder with its Appointment property, like

queryBuilder.Appointment.Start.Since(startDateRange);
queryBuilder.Appointment.End.BeforeOrEqual(endDateRange);

But it’s not including recurring appointments that have a recurrence within that time period. How do I include those?

@rapperson-1,

I suggest you to please visit this documentation link for more information about QueryBuilder. If there is still an issue then please share the working sample code along with test account credentials reproducing the issue.

Here is some working code. How do I provide test account credentials? Our Exchange server is on premises and we don’t have external access.

The issue can be recreated by going back to an earlier date – e.g. a couple months ago – and creating a recurring appointment for every Tuesday at some arbitrary time – e.g. 1:00 PM. Running the code should produce a list with an occurrence of that appointment because the date range in the code includes Tuesday 2020-07-14. However, it does not contain that appointment.

internal static class MainEntryPoint
{
	private static readonly string _exchangeMailboxUri = ""; // <-- put your own URI here.
	private static readonly string _accountName = ""; // <-- put your own account name here.
	private static readonly string _accountPassword = ""; // <-- put your own password here.

	internal static void Main(string[] args)
	{
		var lic = new License();
		lic.SetLicense("Aspose.Total.lic");
		var creds = new System.Net.NetworkCredential(_accountName, _accountPassword);

		using (IEWSClient client = EWSClient.GetEWSClient(_exchangeMailboxUri, creds))
		{
			var queryBuilder = new ExchangeQueryBuilder();
			queryBuilder.Appointment.Start.Since(DateTime.Parse("2020-07-14"));
			queryBuilder.Appointment.End.BeforeOrEqual(DateTime.Parse("2020-07-17"));
			var query = queryBuilder.GetQuery();
			var uriList = client.ListItems(client.MailboxInfo.CalendarUri, query);
			var mapiCalendars = new List<MapiCalendar>();

			foreach (string uri in uriList)
			{
				var mapiCalendar = client.FetchMapiCalendar(new[] { uri }).First();
				mapiCalendars.Add(mapiCalendar);
			}
		}
	}
}

@rapperson-1,

We request you to please provide the test account credentials that you are using on your end to reproduce the issue. Please also share the snapshot of expected result that you want to extract from Aspose.Email API.

As I stated before, our Exchange server is not exposed outside our environment. Even if I gave you the credentials I’m using, you would not be able to use them.

Can you tell me how I can test this on a system where you have access? I don’t have such a system.

@rapperson-1,

In order to further investigate the issue on our end a ticket with ID EMAILNET-39880 has been created. This thread has been linked with the issue so that you may be notified once the support will be included.