Blue Prism Product

Β View Only
last person joined: 23 hours ago 

This community covers the core Blue Prism RPA product.

 Outlook - How To Extract Email ID using Employee Number

Shweta Singh's profile image
Shweta Singh posted 06-16-2023 11:48


Is there a way to get email address based on the Employee number (format of Employee number - 1234567) from Outlook?

I'm using the Outlook VBO, and in Outlook Address book Advanced find, I don't have the option to search with Employee Number. But as per the requirement, I just have an Employee Number and using that I need to extract the Email address (We  get it manually by CTRL+K command).

Please help.

Thank you.

Luis Lopez's profile image
Luis Lopez

At this moment, our MS Outlook VBO does not have that option.

You will need to create a process that opens Outlook and look for that information.

uzer shaikh's profile image
uzer shaikh

Extract Email ID and his Managers Email ID using Employee Number.

Thanks for the Solution @Sweta Singh

πŸš€ Check out this powerful code snippet for Active Directory user retrieval! 🌐

Are you looking to streamline your automation processes? This code is a game-changer. It efficiently fetches user and manager details from the Active Directory, ensuring seamless data retrieval for your automation tasks.

πŸ” With meticulous handling for user existence, error management, and retrieval of manager details, this code snippet sets the standard for precise, error-free automation.

Discover the efficiency of user and manager data extraction and elevate your automation game with this expertly crafted code!

Initailization :


success = false;
message = "An error occurred."; // Default error message
EmailID = "";
ManagerEmailID = "";
exist = false;

    using (PrincipalContext context = new PrincipalContext(ContextType.Domain, AD_DomainName))
        using (UserPrincipal user = UserPrincipal.FindByIdentity(context, System.DirectoryServices.AccountManagement.IdentityType.SamAccountName, userName))
            if (user != null)
                exist = true;
                EmailID = user.EmailAddress;

                // Retrieve the user's manager
                if (user.GetUnderlyingObject() is DirectoryEntry directoryEntry && directoryEntry.Properties.Contains("manager"))
                    string managerDistinguishedName = directoryEntry.Properties["manager"].Value?.ToString();

                    // Fetch manager details by distinguished name
                    if (!string.IsNullOrEmpty(managerDistinguishedName))
                        using (UserPrincipal manager = UserPrincipal.FindByIdentity(context, System.DirectoryServices.AccountManagement.IdentityType.DistinguishedName, managerDistinguishedName))
                            if (manager != null)
                                ManagerEmailID = manager.EmailAddress;
                                success = true; // Update success flag upon successful retrieval
                                message = ""; // Clear error message on success
                // Handle case when user doesn't exist
                message = "User not found in Active Directory.";
catch (Exception e)
    message = e.Message; // Update error message with the exception details
    // Log the exception or handle it as needed
#BluePrism #AutomationDeveloper #CodeEfficiency #ActiveDirectory #AutomationExperts
Uzer Shaikh | Consultant – Automation Developer
Wonder Botz Pvt Ltd.