Hi (again),

I have a loop, which is looking in GW-folders for a message - using the
message's ID.
Sometimes the Message3 object is returned (not null) but when trying to
read a property a System.AccessViolationException is thrown.

Which I find confusing. So here is the related C# code (The part getting
and iterating through the folders received from the Account6 instance is
omitted).

string strMessageId = // "SOME-43-CHARACTER-AND-DIGIT-STRING"
Folder5 folder = // e.g. "Mailbox"
Messages folderMessages = null;
if (folder.ObjType != FolderTypeConstants.egwQuery &&
folder.ObjType != FolderTypeConstants.egwContacts &&
folder.ObjType != FolderTypeConstants.egwIMap &&
folder.ObjType != FolderTypeConstants.egwNNTPNewsGroup &&
folder.ObjType != FolderTypeConstants.egwNNTPServer) {
folder.Refresh();
folderMessages = folder.Messages;
if (folderMessages != null && folderMessages.Count > 0) {
msg = (Message3) folderMessages.Item(strMessageId);
if (msg != null) {
msg.MessageID; // sometimes crashes here
}
}
}

Is there an explanation for this behaviour?

Thanks in advance!
Regards,
Gabriel Jost