Fetch outlook invitation response mail

Hi All,
Please do let me know if there is any way to fetch invitation mail from outlook…

Hi there @nishant.jaiswal

Can you please elaborate what you need. You need the appointments/meetings invites in a collection?

Hi Raghavendraprasad,

I would like to fetch invitation mail message details to perform some transaction on it.
Please find the screen snap for the same:-
image

Suppose if i want to fetch the yellow marked text, how can we do it.

Please do let me know if you would like more information.

1.Get all the mails as List of mail messages.(Use Get Outlook mail message activity or GetIMAP mail message activity or GetPOP3 Mail message activity). Give the server name and credentials in properties panel.
2.Iterate in a for loop by giving condition inside for loop as item.Subject.contains(“Your mail subject to fetch”)
3.If condition is True, you can do the next steps to take the values. Else will take the next item(Keep it as nothing).

Hi @praseedplk
I did try the same for unfortunately it’s skipping the for each look just because this is not the general mail message, i will be performing the task to accepted mail from users.
Please refer the screen shot above.

That is the acceptance mail from User & this mail appears when user accept the meeting invites.

@nishant.jaiswal in that case , also check for ‘Accepted’ keyword as well

Can you try for the html content.

item.Headers(“HTMLBody”).ToString → Assign this to a string variable and check in message box, whether the value is fetching or not

_Test.xaml (7.5 KB)

Hi @praseedplk

I did try but didn’t work, Could you please check the xmal file.

Hi @rrkadari

Not working for me…
I did check.

Areyou getting the top 30 mail in Mail collection variable(TransactionData).
If that , Can you try checking item.Subject.ToString in a message inside the for loop.

i understand that you would like to read outlook calendar , please check this Outlook Calendar Activities - RPA Component | UiPath Marketplace

Hi @nishant.jaiswal

Have you tried the following code

    ExtendedPropertyDefinition CleanGlobalObjectId = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Meeting, 0x23, MapiPropertyType.Binary);
        PropertySet psPropSet = new PropertySet();
        psPropSet.Add(CleanGlobalObjectId);
        AppointmentObj.Load(psPropSet);
        object PropVal= null;
        AppointmentObj.TryGetProperty(CleanGlobalObjectId, out PropVal);
        SearchFilter ItemSearchFilter = new SearchFilter.IsEqualTo(CleanGlobalObjectId, Convert.ToBase64String((Byte[])PropVal));
        FindItemsResults<Item> fiResults1 = service.FindItems(WellKnownFolderName.Inbox, ItemSearchFilter, new ItemView(1000));
        
        foreach (Item itItem in fiResults1.Items) {
            itItem.Load();
            Console.WriteLine(((EmailMessage)itItem).Sender.Address);
            Console.WriteLine(((EmailMessage)itItem).ItemClass);
            Console.WriteLine(itItem.Body.Text);
         } 

Or look at this detailed answer in MSDN forum on how to retrieve the invite responses from your inbox : Outlook Exchange: How to get meeting attendees response and comments using c#

Or you can check this out:

  public static void ReadOutlookResponse(string outlookAppointmentName)
    {
        Outlook.Items folderItems = null;
        string searchCriteria = "[Subject]='" + outlookAppointmentName + "'";

        // 1 - Returns Only 1
        MeetingItem item = null;
        Application myoutlook = new Application();
        item = myoutlook.Session.GetDefaultFolder(OlDefaultFolders.olFolderInbox).Items
            .Find("[Subject]='" + outlookAppointmentName + "'");
        string body = item.Body;

        // 2 - Loop and Return All
        folderItems = myoutlook.Session.GetDefaultFolder(OlDefaultFolders.olFolderInbox).Items;
        object resultItem = folderItems.Find(searchCriteria);
        while (resultItem != null)
        {
            if (resultItem is Outlook.MeetingItem)
            {
                item = resultItem as Outlook.MeetingItem;
                body = item.Body;
            }
            Marshal.ReleaseComObject(resultItem);
            resultItem = folderItems.FindNext();
        }
    }

Hope this helps :slight_smile:

Hi @Raghavendraprasad

I will be working on ur solution provided once done i will make it as solution.

Yes feel free to revert if you face any challenges. :slight_smile: