{"record":{"id":"5836e9456119ed72","repo":"jstedfast/MailKit","slug":"the-imap-server-does-not-support-the-special-use-nor-xlist","errorCode":null,"errorMessage":"The IMAP server does not support the SPECIAL-USE nor XLIST extensions.","messagePattern":"The IMAP server does not support the SPECIAL-USE nor XLIST extensions\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"MailKit/Net/Imap/ImapClient.cs","lineNumber":2292,"sourceCode":"\t\t/// The <see cref=\"ImapClient\"/> has been disposed.\n\t\t/// </exception>\n\t\t/// <exception cref=\"ServiceNotConnectedException\">\n\t\t/// The <see cref=\"ImapClient\"/> is not connected.\n\t\t/// </exception>\n\t\t/// <exception cref=\"ServiceNotAuthenticatedException\">\n\t\t/// The <see cref=\"ImapClient\"/> is not authenticated.\n\t\t/// </exception>\n\t\t/// <exception cref=\"System.NotSupportedException\">\n\t\t/// The IMAP server does not support the SPECIAL-USE nor XLIST extensions.\n\t\t/// </exception>\n\t\tpublic override IMailFolder? GetFolder (SpecialFolder folder)\n\t\t{\n\t\t\tCheckDisposed ();\n\t\t\tCheckConnected ();\n\t\t\tCheckAuthenticated ();\n\n\t\t\tif ((Capabilities & (ImapCapabilities.SpecialUse | ImapCapabilities.XList)) == 0)\n\t\t\t\tthrow new NotSupportedException (\"The IMAP server does not support the SPECIAL-USE nor XLIST extensions.\");\n\n\t\t\tswitch (folder) {\n\t\t\tcase SpecialFolder.All:       return engine.All;\n\t\t\tcase SpecialFolder.Archive:   return engine.Archive;\n\t\t\tcase SpecialFolder.Drafts:    return engine.Drafts;\n\t\t\tcase SpecialFolder.Flagged:   return engine.Flagged;\n\t\t\tcase SpecialFolder.Important: return engine.Important;\n\t\t\tcase SpecialFolder.Junk:      return engine.Junk;\n\t\t\tcase SpecialFolder.Sent:      return engine.Sent;\n\t\t\tcase SpecialFolder.Trash:     return engine.Trash;\n\t\t\tdefault: throw new ArgumentOutOfRangeException (nameof (folder));\n\t\t\t}\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Get the folder for the specified namespace.\n\t\t/// </summary>\n\t\t/// <remarks>","sourceCodeStart":2274,"sourceCodeEnd":2310,"githubUrl":"https://github.com/jstedfast/MailKit/blob/9d3859a7855e3e17582c07fd01972b8e262bf176/MailKit/Net/Imap/ImapClient.cs#L2274-L2310","documentation":"GetFolder(SpecialFolder) throws NotSupportedException when neither the SPECIAL-USE nor the legacy XLIST capability is present, since mapping well-known folders requires the server to advertise special-use attributes.","triggerScenarios":"Calling client.GetFolder(SpecialFolder.All/Drafts/etc.) against a server without SPECIAL-USE or XLIST; older servers pre-RFC 6154.","commonSituations":"Legacy mail servers or minimal proxies; code using SpecialFolder convenience API against servers that only list plain folders.","solutions":["Check (client.Capabilities & (ImapCapabilities.SpecialUse | ImapCapabilities.XList)) != 0 before calling","Fall back to GetFolder(client.PersonalNamespaces[0]) and match folders by name (INBOX, Drafts, Sent...)","Enumerate client.GetFolders and inspect folder.Attributes for SpecialUse/Sent/Drafts flags where available"],"exampleFix":"// before\nvar drafts = client.GetFolder(SpecialFolder.Drafts);\n// after\nImapFolder drafts;\nif ((client.Capabilities & (ImapCapabilities.SpecialUse | ImapCapabilities.XList)) != 0)\n    drafts = client.GetFolder(SpecialFolder.Drafts);\nelse\n    drafts = (ImapFolder)client.GetFolder(\"Drafts\");","handlingStrategy":"fallback","validationCode":"bool canMap = (client.Capabilities & (ImapCapabilities.SpecialUse | ImapCapabilities.XList)) != 0;","typeGuard":null,"tryCatchPattern":"try { folder = client.GetFolder(SpecialFolder.Drafts); }\ncatch (NotSupportedException) { folder = client.GetFolder(\"Drafts\") as ImapFolder; }","preventionTips":["Enumerate GetFolders + folder.Attributes to locate special folders manually","Maintain a name-based fallback map (INBOX, Drafts, Sent, Trash)","Log capabilities to catch servers lacking SPECIAL-USE early"],"tags":["imap","special-use","capability","mailkit"],"backgroundTag":"operation-not-supported","analyzedSha":"9d3859a7855e3e17582c07fd01972b8e262bf176","analyzedAt":"2026-09-15T15:46:11.592Z","contentChangedAt":"2026-09-15T15:46:11.592Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}