Browse our Products

Aspose.Email for CPP 20.11 Release Notes

Aspose.Email for C++ 20.11 is based on Aspose.Email for .NET 20.11.

New Features

Exchange Autodiscover Service Client

Aspose.Email for C++ now supports AutodiscoverService.

Code sample:

#include <Clients/Exchange/Autodiscover/AutodiscoverService.h>
using namespace Aspose::Email::Clients::Exchange;

void main()
{
    System::String email = u"testemail@aspose.com";
    System::String password = u"testpassword";
    System::SharedPtr<AutodiscoverService> svc = System::MakeObject<AutodiscoverService>();
    svc->set_Credentials(System::MakeObject<System::Net::NetworkCredential>(email, password));
    
    auto userSettings = svc->GetUserSettings(email, System::MakeArray<UserSettingName>({UserSettingName::ExternalEwsUrl}))->get_Settings();
    System::String ewsUrl = System::ObjectExt::Unbox<System::String>(userSettings[UserSettingName::ExternalEwsUrl]);
    System::Console::WriteLine(System::String(u"Auto discovered EWS Url: ") + ewsUrl);
}

Find more details in Aspose.Email for C++ documentation.

Retrieve Exchange Items With an Ascending/Descending Order Sorting

We’ve added sorting feature to MailQueryBuilder.

The following API has been added:

  • Aspose::Email::Tools::Search::ComparisonField::OrderBy(bool ascending) - sets the value which indicates if the client uses ascending or descending sorting on the search field.

Code sample:

    System::SharedPtr<MailQueryBuilder> builder = System::MakeObject<MailQueryBuilder>();
    builder->get_Subject()->Contains(u"Report");
    builder->get_InternalDate()->Since(System::DateTime(2020, 1, 1));
    builder->get_Subject()->OrderBy(true); // sort the subject ascending
    builder->get_InternalDate()->OrderBy(false); // sort the date descending  
    System::SharedPtr<ExchangeMessageInfoCollection> miColl = client->ListMessages(client->get_MailboxInfo()->get_InboxUri(), builder->GetQuery());

The full code of the example can be found at Aspose Email for C++ GitHub examples repository