Sample code for 30+ languages & platforms
Delphi ActiveX

Transition from Imap.ListMailboxes to Imap.MbxList

Provides instructions for replacing deprecated ListMailboxes method calls with MbxList.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Integer;
imap: TChilkatImap;
reference: WideString;
mbxPattern: WideString;
mboxesObj: IMailboxes;
subscribed: Integer;
mboxes: TMailboxes;

begin
success := 0;

imap := TChilkatImap.Create(Self);

// ...
// ...

reference := '';
mbxPattern := '*';

// ------------------------------------------------------------------------
// The ListMailboxes method is deprecated:

// Lists all mailboxes, including unsubscribed.
mboxesObj := imap.ListMailboxes(reference,mbxPattern);
if (imap.LastMethodSuccess = 0) then
  begin
    Memo1.Lines.Add(imap.LastErrorText);
    Exit;
  end;

// ...
// ...

// ------------------------------------------------------------------------
// Do the equivalent using MbxList.
// Your application creates a new, empty Mailboxes object which is passed 
// in the last argument and filled upon success.

// Lists all mailboxes, including unsubscribed.
subscribed := 0;

mboxes := TMailboxes.Create(Self);
success := imap.MbxList(subscribed,reference,mbxPattern,mboxes.ControlInterface);
if (success = 0) then
  begin
    Memo1.Lines.Add(imap.LastErrorText);
    Exit;
  end;
end;