Currently, Rebex Imap client does not offer built-in support for setting the SpecialUse state of an ImapFolder.
However, the task is feasible with Rebex.Net.Imap. Please note that the server has to support the USE parameter of CREATE command. You can check if the server supports it with this code:
imap.SendCommand("CAPABILITY");
ImapResponse response;
response = imap.ReadResponse();
if (!response.GetLines()[0].Parameters.Contains("CREATE-SPECIAL-USE"))
{
Console.WriteLine("IMAP server does not support the optional USE parameter of the CREATE command.");
return;
}
/* server supports creating the Special use folder so you can use the Imap.SendCommand and Imap.ReadResponse methods to create a 'MySpecial' IMAP folder with a specified SpecialUses like this:*/
imap.SendCommand("CREATE", "MySpecial", @"(USE (\Drafts \Sent))");
ImapResponse response = imap.ReadResponse();
if (response.Code != ImapResponseCode.Ok)
throw new ImapException(response);
The above code corresponds to the example from RFC6154, section 5.3. Please note that CREATE-SPECIAL-USE is an optional feature for IMAP server to implement. For more information see the full RFC6154.