Vu Tran
Vu Tran

Reputation: 610

Creating subfolders in Mailcore2 with Gmail

I followed the thread on github here: https://github.com/MailCore/mailcore2/issues/321

And subsequently used the following code below:

MCOIMAPFetchNamespaceOperation * op = [session fetchNamespaceOperation];
[op start:^(NSError * error, NSDictionary * namespaces) {
    if (error != nil)
        return;
    MCOIMAPNamespace * ns = [namespaces objectForKey:MCOIMAPNamespacePersonal];
    NSString * path = [ns pathForComponents:[NSArray arrayWithObjects:@"test", @"sub1", nil]];
    MCOIMAPOperation * createOp = [session createFolderOperation:path];
    [createOp start:^(NSError * error) {
    }];

    path = [ns pathForComponents:[NSArray arrayWithObjects:@"test", @"sub2", nil]];
    createOp = [session createFolderOperation:path];
    [createOp start:^(NSError * error) {
    }];

    path = [ns pathForComponents:[NSArray arrayWithObjects:@"test", @"sub3", nil]];
    createOp = [session createFolderOperation:path];
    [createOp start:^(NSError * error) {
    }];
}];

However, when I log onto my Desktop Gmail account, I see that the folder structure looks like this:

On GMail

Rather than a subfolder structure I would expect, e.g., Mailbox:

enter image description here

Am I doing something or is this an error with Mailcore2?

EDIT: Answer is to create the parent folder first, then the subfolders.

Upvotes: 1

Views: 193

Answers (1)

Max
Max

Reputation: 11000

Create a "test" folder first, for those to be subfolders of.

Otherwise you are left with a "virtual" test folder, which in the case of gmail web ui, will show with slashes instead.

Upvotes: 1

Related Questions