// Spludlow Software
// Copyright © Samuel P. Ludlow 2020 All Rights Reserved
// Distributed under the terms of the GNU General Public License version 3
// Distributed WITHOUT ANY WARRANTY; without implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
// https://www.spludlow.co.uk/LICENCE.TXT
// The Spludlow logo is a registered trademark of Samuel P. Ludlow and may not be used without permission
// v1.14
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Microsoft.Exchange.WebServices.Data;
namespace Spludlow
{
///
/// EWS - Simple TraceListener to grab XML that's passed around
///
public class ExchangeTraceListener : ITraceListener
{
public ExchangeTraceListener()
{
this.Reset();
}
public List Results;
public void Reset()
{
this.Results = new List();
}
public string[] Read()
{
return this.Results.ToArray();
}
public void Trace(string traceType, string traceMessage)
{
this.Results.Add(this.CleanRecord(traceMessage));
}
private string CleanRecord(string input)
{
// Seem some results that arn't enclosed in (EWS Contacts with over 8K results) didn't contain any CR also. Avoid large datasets !!!
if (input.StartsWith("")
break;
result.AppendLine(line);
}
}
return result.ToString();
}
}
}