View Single Post
  #1  
Old April 8th 09, 12:13 PM posted to microsoft.public.outlook.program_addins
Janni
external usenet poster
 
Posts: 1
Default Specified cast is not valid

I'm developing a VSTO (second edition) addin for Outlook. One of my
customers gets the following error:

"System.InvalidCastException: Specified cast is not valid.
at
System.Runtime.InteropServices.Marshal.ThrowExcept ionForHRInternal
(Int32 errorCode, IntPtr errorInfo)
at
System.Runtime.InteropServices.CustomMarshalers.En umerableViewOfDispatch.GetEnumerator
()
at System.Collections.IEnumerable.GetEnumerator() "

when looping through the items in the calendar folder.

Dim oFolder As MsOutlook.MAPIFolder = oSession.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderCalendar)
Dim oItems As MsOutlook.Items = m_oFolder.Items

For Each oItem As Object In oItems
....
Next

Anyone who has any clue about the cause of this error?

Ads