Forum Discussion
API / link for a list of Outlook/OWA/Office default folder names/strings
I'm trying to build a process that should read emails from default folders like Inbox, Drafts, Sent Items, Etc. To make it generic, I would need a list of the default translation folder names/strings Office/Exchange/Email providers use when the localization attribute changes.
Till now, I haven't found that list/API on my online search, nor either by investigating office files.
Please advice.
Thank you for your help. I've created the following class which I believe could and should be added to the official API.
using System; using System.Collections.Generic; using System.Reflection; using Oulook = Microsoft.Office.Interop.Outlook; namespace OutlookDefualtFolderNames { public static class OutlookToolsHMS { private const string k_MapiNamespaceStr = "mapi"; private static Oulook.NameSpace GetOutlookNameSpace() { Oulook.Application oApp; Oulook.NameSpace oNS; // Create the Outlook application. // in-line initialization oApp = new Oulook.Application(); // Get the MAPI namespace. oNS = oApp.GetNamespace(k_MapiNamespaceStr); // Log on by using the default profile or existing session (no dialog box). oNS.Logon(Missing.Value, Missing.Value, false, true); // Alternate logon method that uses a specific profile name. // TODO: If you use this logon method, specify the correct profile name // and comment the previous Logon line. //oNS.Logon("profilename",Missing.Value,false,true); return oNS; } public static List<string> GetAllDefualtTranslatedFolderNames() { List<string> folderNames = new List<string>(); Oulook.NameSpace oNS = GetOutlookNameSpace(); foreach (var folder in Enum.GetValues(typeof(Oulook.OlDefaultFolders))) { try { folderNames.Add(oNS.GetDefaultFolder((Oulook.OlDefaultFolders)folder).Name); } catch { } } return folderNames; } public static List<string> GetDefualtTranslatedFolderName(string name) { List<string> folderNames = new List<string>(); Oulook.NameSpace oNS = GetOutlookNameSpace(); string folderName; foreach (var folder in Enum.GetValues(typeof(Oulook.OlDefaultFolders))) { try { if (folder.ToString().ToLower().Contains(name.ToLower())) { folderName = oNS.GetDefaultFolder((Oulook.OlDefaultFolders)folder).Name; folderNames.Add(folderName); } } catch { } } return folderNames; } } }
- Victor_IvanidzeBronze ContributorUse well-known folder names instead of localized names.
See https://docs.microsoft.com/ru-ru/dotnet/api/microsoft.exchange.webservices.data.wellknownfoldername?view=exchange-ews-api- sagiselaCopper Contributor
Thank you for your answer, but I don't find a way to have the actual folder name. Instead, it always returns the English folder name.
For example, when I tried to print the result of the following line:
Microsoft.Exchange.WebServices.Data.WellKnownFolderName.InboxThe output was "Inbox" even the actual name was "תיבת דואר נכנס" (the translation of inbox to Hebrew).
- Victor_IvanidzeBronze Contributor
Hi sagisela,
as far as I understood your initial question, you do not need to know the real name of the folder.
Just get an ID of the well-known folder Inbox and forget it's name.