SOLVED

API / link for a list of Outlook/OWA/Office default folder names/strings

%3CLINGO-SUB%20id%3D%22lingo-sub-2181568%22%20slang%3D%22en-US%22%3EAPI%20%2F%20link%20for%20a%20list%20of%20Outlook%2FOWA%2FOffice%20default%20folder%20names%2Fstrings%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2181568%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20trying%20to%20build%20a%20process%20that%20should%20read%20emails%20from%20default%20folders%20like%20Inbox%2C%20Drafts%2C%20Sent%20Items%2C%20Etc.%20To%20make%20it%20generic%2C%20I%20would%20need%20a%20list%20of%20the%20default%20translation%20folder%20names%2Fstrings%20Office%2FExchange%2FEmail%20providers%20use%20when%20the%20localization%20attribute%20changes.%3C%2FP%3E%3CP%3ETill%20now%2C%20I%20haven't%20found%20that%20list%2FAPI%20on%20my%20online%20search%2C%20nor%20either%20by%20investigating%20office%20files.%3C%2FP%3E%3CP%3EPlease%20advice.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2181568%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOutlook%20for%20Windows%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2184364%22%20slang%3D%22en-US%22%3ERe%3A%20API%20%2F%20link%20for%20a%20list%20of%20Outlook%2FOWA%2FOffice%20default%20folder%20names%2Fstrings%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2184364%22%20slang%3D%22en-US%22%3EUse%20well-known%20folder%20names%20instead%20of%20localized%20names.%3CBR%20%2F%3ESee%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fru-ru%2Fdotnet%2Fapi%2Fmicrosoft.exchange.webservices.data.wellknownfoldername%3Fview%3Dexchange-ews-api%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fru-ru%2Fdotnet%2Fapi%2Fmicrosoft.exchange.webservices.data.wellknownfoldername%3Fview%3Dexchange-ews-api%3C%2FA%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2191489%22%20slang%3D%22en-US%22%3ERe%3A%20API%20%2F%20link%20for%20a%20list%20of%20Outlook%2FOWA%2FOffice%20default%20folder%20names%2Fstrings%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2191489%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F100937%22%20target%3D%22_blank%22%3E%40Victor%20Ivanidze%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20answer%2C%20but%20I%20don't%20find%20a%20way%20to%20have%20the%20actual%20folder%20name.%20Instead%2C%20it%20always%20returns%20the%20English%20folder%20name.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20example%2C%20when%20I%20tried%20to%20print%20the%20result%20of%20the%20following%20line%3A%3CBR%20%2F%3EMicrosoft.Exchange.WebServices.Data.WellKnownFolderName.Inbox%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20output%20was%20%22Inbox%22%20even%20the%20actual%20name%20was%20%22%D7%AA%D7%99%D7%91%D7%AA%20%D7%93%D7%95%D7%90%D7%A8%20%D7%A0%D7%9B%D7%A0%D7%A1%22%20(the%20translation%20of%20inbox%20to%20Hebrew).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2191546%22%20slang%3D%22en-US%22%3ERe%3A%20API%20%2F%20link%20for%20a%20list%20of%20Outlook%2FOWA%2FOffice%20default%20folder%20names%2Fstrings%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2191546%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F984978%22%20target%3D%22_blank%22%3E%40sagisela%3C%2FA%3E%2C%26nbsp%3B%3C%2FP%3E%3CP%3Eas%20far%20as%20I%20understood%20your%20initial%20question%2C%20you%20do%20not%20need%20to%20know%26nbsp%3B%20the%20real%20name%20of%20the%20folder.%3C%2FP%3E%3CP%3EJust%20get%20an%20ID%20of%20the%20well-known%20folder%20Inbox%20and%20forget%20it's%20name.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2191579%22%20slang%3D%22en-US%22%3ERe%3A%20API%20%2F%20link%20for%20a%20list%20of%20Outlook%2FOWA%2FOffice%20default%20folder%20names%2Fstrings%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2191579%22%20slang%3D%22en-US%22%3E%3CP%3EI%20apologize%20for%20the%20misunderstanding.%3CBR%20%2F%3EI%20need%20the%20real%20folder%20name.%20Therefore%2C%20I'm%20asking%20for%20a%20list%20of%20the%20default%20translation%20folder%20names%20or%20an%20API%20which%20could%20provide%20a%20default%20translated%20folder%20name%20by%20language%2C%20which%20should%20be%20something%20like%3A%3CBR%20%2F%3EgetLocalizedFolderName(%22Inbox%22%2C%20%22Hebrew%22)%3CBR%20%2F%3Eor%26nbsp%3B%3CBR%20%2F%3EMicrosoft.Exchange.WebServices.Data.WellKnownFolderName.Inbox.getLocalizedNameFor(%22Hebrew%22)%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

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.

15 Replies

@Victor Ivanidze 

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.Inbox

 

The output was "Inbox" even the actual name was "תיבת דואר נכנס" (the translation of inbox to Hebrew).

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.

I apologize for the misunderstanding.
I need the real folder name. Therefore, I'm asking for a list of the default translation folder names or an API which could provide a default translated folder name by language, which should be something like:
getLocalizedFolderName("Inbox", "Hebrew")
or 
Microsoft.Exchange.WebServices.Data.WellKnownFolderName.Inbox.getLocalizedNameFor("Hebrew")

Yes, but since I'm developing an RPA process using UiPath and using UiPath Email tools for the development, which use the folder name as a filter and can't use the folder id, I haven't found them useful.
And did you asking for help the UIPath support?

@Victor Ivanidze 

I haven't asked for help the UIPath support because I believe Microsoft should offer a solution. That's certainly not the kind of information Microsoft should avoid sharing.

Moreover, I'm sure Microsoft wants us (developers) to be happy and feel comfortable in order to encourage us to keep developing more tools and features for/using Microsoft programs and platforms.

Hi @sagisela, IMHO your approach is a bit strange.

As you know, each folder has a language-independent ID.  You said you want to use 100 different names of Inbox in different languages instead of asking UIPath if they provide a method to get the folder by ID and not by name. MS provides such method in their APIs.  I know nothing about UiPath but if they have the only method to get the folder by name I'd say they are non-professional.

 

 

I haven't said I want to use 100 different names of Inbox in different languages I said that as MS provides an API to get the folder ID they could also provide an API to get the default folder name for a specific language, not only for my specific case but for many others that might need to use those names in other scenarios.
Dear sir, could you please explain why do you want to know the name of Inbox in Russian if you are using Hebrew Outlook? For what?
Yes, Let's consider, for example, that I've used Hebrew Outlook on my computer for a while, then, I've got a new phone and decided I want to improve my Russian, so I have set my new phone in Russian and then automatically my Outlook changed to Russian in my computer too. Because of that, all Outlook folder names changed also.
When filtering by folder name, my process would fail. Yes, if I would use the folder ID instead of the folder name, the process will survive those changes, but if my process also logged every new email with the following message:
"New Email received in " + folder name + " from " + sender name
because the owner wants to analyze his workers' most common language or any other reason he asked me to add these log messages, I need to have the folder name.
Please assist if you can, and if you can't, please stop challenging me in unnecessary explanations.

Hi @sagisela, please don't be offended - I'm really trying to help.

 

You wrote:

Yes, if I would use the folder ID instead of the folder name, the process will survive those changes, but if my process also logged every new email with the following message:
"New Email received in " + folder name + " from " + sender name
because the owner wants to analyze his workers' most common language or any other reason he asked me to add these log messages, I need to have the folder name.

 

Look. If you know the olFolderInbox the 2 strings of VBA code

 

Set objFolder=objNameSpace.GetDefaultFolder(olFolderInbox)

Debug.Print objFolder.Name

 

will give you the language-specifics folder name.

 

I'm a bit tired so it's my last reply. Good luck.

 

 

best response confirmed by sagisela (Occasional Contributor)
Solution

@Victor Ivanidze 

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;
        }

    }
}