Outlook (if : Object reference not set to an instance of an object)

This program is an automatic Outlook Mailbox Creator creates new mailbox folders and moves emails from a specific sender. If the mailbox specified already exists, an alert will be shown whether to use the existing mailbox or user can opt to create a new mailbox. Once the new mailbox is created based on input provided, emails move automatically to this folder.

Simple Use case

· Select small or group of emails (bulk) to move from one folder to another.

· Indicate source and destination folder.

· Indicate from which email address, emails have to be moved.

· If the destination folder already exists, raise a message to user to use the existing folder or create a new folder.

· Provide date range from when to when emails should be looked upon.


· NewFolderName - Name of the mailbox folder where emails will be moved. This can be an existing folder or a new folder.

· EmailID – eMails or domains from this Email ID will be moved from Inbox to folder specified above.

· Top - Number of emails that will be looked upon for movement within given specified date range.

· FromDate - Filter indicating from which date emails have to be looked upon for a match to move. ‘dd-MM-yy’ format

· ToDate - Filter indicating till which date emails have to be looked upon for a match to move. ‘dd-MM-yy’ format

How to run

· Provide relevant configuration details in the config spreadsheet.

· Make sure Outlook account is setup in the machine where the bot is executed.

· Execute the Bot.

· Check whether Mailbox folder indicated in the configuration is created.

· Check whether all emails from sender specified in configuration within specified date range are moved to the new Mailbox folder created.
this is some media for the software

transformed_Media1 transformed_Media2 transformed_Media4 transformed_Media6 transformed_Media7 transformed_Media8 transformed_Media9 transformed_Media11

The program works perfectly when I use my Hotmail email as showed in the pictures below

however when i use my gmail account this error appears


i found out that the problem when i use gmail is in the item variable


when i use hotmail (item) takes the value from outlook

in gmail the value is null

i dont know why the item dont take value when i use gmail or my company domain
please help me i am trying to solve this issue for over a week now.
this is the workflow Outlook_FolderCreation_MailMovement.zip (28.6 KB)
thanks in advance.

1 Like

This may not help but I have seen this before then I have hyperlinks in my config file ( i.e. gmail in the EmailID field is blue and underlined, just right click and remove hyperlink), if you removed the hyperlink in your config file does it work?

1 Like

hi @cwedl,
i tried this before and didnt work, but thanks for your response :heart: