Get Outlook Inbox folder current name

Hi,

I want to build a strong GetOutlookMailMessages implementation. If the windows language changes, the Outlook Inbox folder name is changeing with that to. As you know, we have to specific the mail folder exact name to get emails from it. Is it possible for me as a developer, to get this information (i mean the Inbox folder current name) from somewhere? I am looking something like: Environment.Outlook.InboxFolder.Name.

Thanks in advance,
János!

@j.marton

Check below link, It maybe the creation of the folder, but you can try to change according to your usecase

http://rpa-daddy.com/?p=370

Hope this may help you

Thanks

Thanks, I looked at the link, but unfortunately it wasn’t helpful to me.

have some researches in this direction:

oapp = new Microsoft.Office.Interop.Outlook.ApplicationClass()
oapp.GetNamespace(“MAPI”).GetDefaultFolder(OlDefaultFolders.olFolderInbox ).Name

1 Like

Thanks, I researched in this direction, but found nothing useful.

I am facing with this compile error:
Error ERROR Validation Error Compiler error(s) encountered processing expression “New Microsoft.Office.Interop.Outlook.ApplicationClass()”.
Type ‘Microsoft.Office.Interop.Outlook.ApplicationClass’ is not defined. Main.xaml

I don’t know how could I define Microsoft.Office.Interop.Outlook.ApplicationClass

with the code lines from above i was able to get the localized name (german) of the inbox folder

give try to add Microsoft.Office.Interop.Outlook to the namespace (import panel vlose to the variable panel)

1 Like

Thank you very much, after all this I was able to create a working solution! :grinning:

A possible solution in summarize:

You need to import this: Microsoft.Office.Interop.Outlook

Variables:
InboxName (String)
oApp (Microsoft.Office.Interop.Outlook.Application)

Activity:
Invoke code
Arguments:
Name: oInboxName Direction: Out Type: String Value: InboxName
Name: oApp Direction: In Type: Microsoft.Office.Interop.Outlook.Application Value: oApp
Code:

oApp = New Microsoft.Office.Interop.Outlook.ApplicationClass()
o_InboxName = oApp.GetNamespace(“MAPI”).GetDefaultFolder(OlDefaultFolders.olFolderInbox).Name

Language: VBNet

Then InboxName should be the name of the current inbox.

1 Like

WE can do IT directly within assign activities as well

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

I tried, but I got these 2 complie errors:

Error	ERROR	Validation Error	Compiler error(s) encountered processing expression "New Microsoft.Office.Interop.Outlook.ApplicationClass()".
Option Strict On disallows implicit conversions from 'Microsoft.Office.Interop.Outlook.ApplicationClass' to 'Microsoft.Office.Interop.Outlook.Application'.	Main.xaml

Error	ERROR	Validation Error	Compiler error(s) encountered processing expression "oApp.GetNamespace(“MAPI”).GetDefaultFolder(OlDefaultFolders.olFolderInbox).Name".
'OlDefaultFolders' is ambiguous in the namespace 'Microsoft.Office.Interop.Outlook'.	Main.xaml

I have Microsoft.Office.Interop.Outlook Import.
Any suggestion?

the conflict can be resolved when checking the XAML within a text editor /e.g. notepad++) and correct it if needed:

any references to UiPath.Mail and relates to this are to remove as it is creating the resolution issue

find starter help here:
GetRootFolderName.xaml (3.7 KB)