Sandesh555
asked on
Error coming up when using "GetItemFromID"
Hi Team,
I am trying to run the given below code and I am not able to proceed further as it is giving me some error. It had run for a couple of times, but stoped working all of a sudden.
Given below is the code.
Private Sub cmdViewEmail_Click()
Dim olFolder As Outlook.MAPIFolder
Dim olConversationIndex As String
olConversationIndex = [Form_qryEmails&Comments subform].Conservation_Inde x
Set olFolder = GetOlFolder("\\Mailbox - Operations Collections\Inbox")
Set Test = olFolder.Session.GetItemFr omID("0101 CD0EB640F8 EC9BCA0990 2E4383A0DE 3146196E1A 9683932700 800178B580 ")
Test.Display
End Sub
Given below is the error I get when I try to run the above code.
I also did some further testing and it seems to work for certain emails and does work for certain emails. Please note the folder has only emails, no calander or task etc..
Thanks,
Sandesh.
I am trying to run the given below code and I am not able to proceed further as it is giving me some error. It had run for a couple of times, but stoped working all of a sudden.
Given below is the code.
Private Sub cmdViewEmail_Click()
Dim olFolder As Outlook.MAPIFolder
Dim olConversationIndex As String
olConversationIndex = [Form_qryEmails&Comments subform].Conservation_Inde
Set olFolder = GetOlFolder("\\Mailbox - Operations Collections\Inbox")
Set Test = olFolder.Session.GetItemFr
Test.Display
End Sub
Given below is the error I get when I try to run the above code.
I also did some further testing and it seems to work for certain emails and does work for certain emails. Please note the folder has only emails, no calander or task etc..
Thanks,
Sandesh.
Are you sure that an Item with that ID exists?
If they exist, are they in \Mailbox - Operations Collections\Inbox ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Team,
Each and every mail item that I have captured in my database exits and In case of the given coding, sorry for the confusion. I had included only a part of the code and did not remove all the not related lines. Here is the code again.
Private Sub cmdViewEmail_Click()
Dim olFolder As Outlook.MAPIFolder
Set olFolder = GetOlFolder("\\Mailbox - Operations Collections\Inbox")
Set Test = olFolder.Session.GetItemFr omID("0101 CD0EB640F8 EC9BCA0990 2E4383A0DE 3146196E1A 9683932700 800178B580 ")
Test.Display
End Sub
GetOlFolder() here is a small function which converts the given Outlook folder path into a proper MAPI Folder path.
I did try to declare Test as a MailItem, but was getting same error. Please note I problem here is that this code is working for a few emails and does not work for a few emails.
Thanks,
Sandesh.
Each and every mail item that I have captured in my database exits and In case of the given coding, sorry for the confusion. I had included only a part of the code and did not remove all the not related lines. Here is the code again.
Private Sub cmdViewEmail_Click()
Dim olFolder As Outlook.MAPIFolder
Set olFolder = GetOlFolder("\\Mailbox - Operations Collections\Inbox")
Set Test = olFolder.Session.GetItemFr
Test.Display
End Sub
GetOlFolder() here is a small function which converts the given Outlook folder path into a proper MAPI Folder path.
I did try to declare Test as a MailItem, but was getting same error. Please note I problem here is that this code is working for a few emails and does not work for a few emails.
Thanks,
Sandesh.
What is the difference between the mails for which it does work and the mails for which it does not?
ASKER
Not much all of them are emails sent and recived by the customer.
ASKER
HI Team,
I did some testing and found out that all the emails that have been sent from my domain is coming up in the dispaly, but all the emails that have been sent by external team is not wokring.
I am also giving you the question were I got this solution.
https://www.experts-exchange.com/questions/27655636/Complete-Folderpath-of-Outlook-Email.html
Thanks,
Sandesh.
I did some testing and found out that all the emails that have been sent from my domain is coming up in the dispaly, but all the emails that have been sent by external team is not wokring.
I am also giving you the question were I got this solution.
https://www.experts-exchange.com/questions/27655636/Complete-Folderpath-of-Outlook-Email.html
Thanks,
Sandesh.
ASKER
Hi Team,
After doing some additinal testing I found that the first time I use this code. It works for all emails. But later it starts to work only on emails sent from my domain.
I think we jsut need to clear some memory somewere. All I need to know is what is it that I need to clear.
Thanks,
Sandesh.
After doing some additinal testing I found that the first time I use this code. It works for all emails. But later it starts to work only on emails sent from my domain.
I think we jsut need to clear some memory somewere. All I need to know is what is it that I need to clear.
Thanks,
Sandesh.
ASKER
Hi Team,
I have found the solution locally, though another developer.
thanks for looking into the same.
Thanks,
Sandesh.
I have found the solution locally, though another developer.
thanks for looking into the same.
Thanks,
Sandesh.