+2 votes

I want to create a selectable Parent folder that contains multiple children folders in Gmail.

If I use this code :

imap.CreateFolder("ParentFolderName"); imap.CreateFolder("ParentFolderName/Children1FolderName"); imap.CreateFolder("ParentFolderName/Children2FolderName");

I have a non selectable Parent (\Noselect \HasChildren). And in my Gmail Interface I just see the children folders like this (no parent folder) :

"ParentFolderName/Children1FolderName",
"ParentFolderName/Children2FolderName"

How can I create a parent folder without the flag \Noselect ?

Thanks

by

1 Answer

+1 vote
 
Best answer

I think you are mistaken.

If you create ParentFolderName explicitly, like you showed (using imap.CreateFolder("ParentFolderName") call) the folder is selectable:

const string parentName = "ParentFolderName";

imap.CreateFolder(parentName);
imap.CreateFolder(parentName + "/Child1");

FolderInfo parent = imap.GetFolders().Find(x => x.Name == parentName);

Assert.AreEqual(true, parent.CanSelect);

imap.Select(parent);

If however the folder is created implicitly (as a side effect of creating child folder) it isn't selectable:

const string parentName = "ParentFolderName";

//imap.CreateFolder(parentName);           // don't create parent
imap.CreateFolder(parentName + "/Child1"); // creates parent implicitly

FolderInfo parent = imap.GetFolders().Find(x => x.Name == parentName);

Assert.AreEqual(false, parent.CanSelect);
by (301k points)
selected by
Ok, my mistake !

thanks
...