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

hello ,
this program sort outlook emails by email or by domain, the software works fine when i use any email other than gmail, when ever i login into my gmail account and run the software it give me this error(If: Object reference not set to an instance of an object) help me please.

i want to upload my workflow but the site keeps telling me i cant becuse i am new member so please provide email so i can send the workflow

@Abdulkader_Sandouka1,

Welcome to our community!
Thank you for posting your query in UiPath Developer Forum.

For Gmail you need to use Gsuite package with “Get IMAP mail messages” activity. Get outlook mails wont work with Gmail. I think that could be the issue, check that.

1 Like

it does, please provide your email so you can see the workflow its small and simple.
regards

thank you for your response
but i am loged in to my gmail in outlook, do you think i need Gsuite for that ?
regards

Kindly try with this expression
item.Sender.Address.ToString.Contains(Config(“EmailIdD”).ToString)

Cheers @Abdulkader_Sandouka1

1 Like

thank you for your response
the same error appear
if i can have the premision to upload my workflow would be great
or if someone can give me his or her email so i can send the workflow, i am new to RPA an Uipath (40 days so far) and i dont have enough experience, an expert look on my work would be helpful and thanks in advanced for every one.

regards

Outlook_FolderCreation_MailMovement.7z (21.8 KB)

this is my workflow
please take a look @Palaniyappan @sarathi125 @Manjuts90

@Abdulkader_Sandouka1 make sure check the config object first its getting value or not.

1 Like

next to get outlook mail activity use a writeline activity like this
OpMail.Count.ToString
so that we will get to know the number of mail fetched
if that is more than 0 then we need to check with the expression and it should be like this
item.Sender.Address.ToString.Contains(Config(“EmailIdD”+index.tostring).ToString)
–and make sure that index value after reaching 5 should end at some point
else it will contiinue with a loop and if it reaches more than the value in your excel this error will occur for sure
–so use a FLOW DECISION before getting the first invoke activity like this
index > 5
if true connect that to a message box and if false connect that to the first invoke workflow file activity

Cheers @Abdulkader_Sandouka1

1 Like

Thanks for your help I will try this and then I will report what happens.
Regads @Palaniyappan

1 Like

Cheers @Abdulkader_Sandouka1

1 Like

first i would like to thank you on your follow up on my problem i appreciate this a lot,
but i think you are talking about this error

this one i was able to avoid by using (try catch) and the program runs perfectly however the first one stops the program from running,
(note that the program runs perfectly when i login to outlook with hotmail) but wont work when i login with my gmail or my company email, you can try it if you have a gmail it wont work.
thanks in advance and sorry to take a lot of your time.

regards @Palaniyappan

This error implies that the key string is formed but that key is not here in the dictionary
So we need to the key string been formed
Use a writeline activity before to this Assign activity and mention the same expression so that we will come to know, may be like this
“EmailIdD”+index.tostring
Using try catch is fine but that can catch the exception which can’t be taken as a final result as that work as expected.

We are almost done

Cheers @Abdulkader_Sandouka1

1 Like

yes but my problem is not the loop error my problem is this error 2
i have an older version of the program that does not have a loop or index value its only take one value from the exel file and the same error apper (the object reference not set to an instance of an object error) i will upload it so you can see Outlook_FolderCreation_MailMovement.zip (28.6 KB)
this one does not have a loop.
regards @Palaniyappan