AutoDiscovery of Exchange Server Settings using Aspose.Email for .NET 18.5

aspose-email-for-.NETWe are pleased to announce the release of Aspose.Email for .NET 18.5. This month’s release introduces several new features related to various API functionality. It also enhances the API by fixing several bugs that were reported by our valued customers with the previous version of the API. For a detailed note on what is new and fixed, please visit the release notes section of Aspose.Email API.

Support for Auto Discover Exchange Server settings

This release introduces a new feature of auto-discovery of Exchange server settings using account’s user name and password. The AutoDiscoverService introduced by the API gets this information from the exchange server using the username and password specified by application user. In addition to other settings returned by the API, you can get the server’s EWS Url as well using this feature.

string email = "";
string password = "password";
AutodiscoverService svc = new AutodiscoverService();
svc.Credentials = new NetworkCredential(email, password);

IDictionary<UserSettingName, object> userSettings = svc.GetUserSettings(email, UserSettingName.ExternalEwsUrl).Settings;
string ewsUrl = (string)userSettings[UserSettingName.ExternalEwsUrl];
Console.WriteLine("Auto discovered EWS Url: "  + ewsUrl);

Abort PST to Exchange Server Operation

PST restore feature of the Aspose.Email API lets you restore the contents of a PST file to Exchange server. The feature being useful in a variety of ways also has the possibility of operation take long time due to large size of PST file. This new release of API lets you abort PST restoration process to Exchange server based on defined time. This allows users to abort the PST restore operation in case it is taking too long to complete the operation.

//create a test pst and add some test messages to it
var pst = PersonalStorage.Create(new MemoryStream(), FileFormatVersion.Unicode);
var folder = pst.RootFolder.AddSubFolder("My test folder");
for (int i = 0; i < 20; i++)
    var message = new MapiMessage("", "", "subj", new string('a', 10000));

//now restore the PST with callback
client.Restore(pst, new Aspose.Email.Clients.Exchange.WebService.RestoreSettings
    BeforeItemCallback = callback

Writing Multiple Events to ICS

Aspose.Email already lets you read multiple events from ICS file. This new release of API lets you write multiple calendar events to a single ICS file as shown in the following code sample.

IcsSaveOptions saveOptions = new IcsSaveOptions();
saveOptions.Action = AppointmentAction.Create;
using (CalendarWriter writer = new CalendarWriter(dataDir + "WriteMultipleEventsToICS_out.ics", saveOptions))
    for (int i = 0; i < 10; i++)
        Appointment app = new Appointment(string.Empty, DateTime.Now, DateTime.Now, "", "");
        app.Description = "Test body " + i;
        app.Summary = "Test summary:" + i;

API Resources

The following API resources can be of help to you in getting started with Aspose.Email API.