Problem Reading Collection in ActiveX
Posted: Fri Aug 07, 2009 12:07 pm
by hml >> Tue, 9 Apr 2002 9:42:00 GMT
I am trying to read a mail from Outlook 2000, and have imported the Outlook ActiveX library and written the following code:
readOutlookMail();
vars
lNamespace : I_NameSpace;
lOutlook : Application_1;
lFolder : MAPIFolder;
lItem : I_Items;
i : Integer;
begin
create lOutlook transient;
lNamespace := lOutlook.getNamespace("MAPI");
lNamespace.logon ("", "", false, false);
lFolder := lNamespace.getDefaultFolder(6);
write lFolder.items.count;
foreach i in 1 to lFolder.items.count do
write lFolder.items;
lItem := lFolder.items.item(1).I_Items;
endforeach;
end;
The above code will read from Outlook, and the first write (lFolder.items.count) will return the correct number of mail items in the Inbox. The second write (lFolder.items) shows that the collection within lFolder.items is of type I_Items.
My problem is when trying to get at one of the objects in the lFolder.items collection (lItem := lFolder.items.item(1).I_Items) I get the following message: "Class of object is invalid in this context." I get this error even though I know that the items are of the correct type.
Can anyone tell me why I get this message, and how I can get around it? I am using Jade 5.2.08
Thanks
Tim
I am trying to read a mail from Outlook 2000, and have imported the Outlook ActiveX library and written the following code:
readOutlookMail();
vars
lNamespace : I_NameSpace;
lOutlook : Application_1;
lFolder : MAPIFolder;
lItem : I_Items;
i : Integer;
begin
create lOutlook transient;
lNamespace := lOutlook.getNamespace("MAPI");
lNamespace.logon ("", "", false, false);
lFolder := lNamespace.getDefaultFolder(6);
write lFolder.items.count;
foreach i in 1 to lFolder.items.count do
write lFolder.items;
lItem := lFolder.items.item(1).I_Items;
endforeach;
end;
The above code will read from Outlook, and the first write (lFolder.items.count) will return the correct number of mail items in the Inbox. The second write (lFolder.items) shows that the collection within lFolder.items is of type I_Items.
My problem is when trying to get at one of the objects in the lFolder.items collection (lItem := lFolder.items.item(1).I_Items) I get the following message: "Class of object is invalid in this context." I get this error even though I know that the items are of the correct type.
Can anyone tell me why I get this message, and how I can get around it? I am using Jade 5.2.08
Thanks
Tim