Hi Guys
“Invoke Code:Exception has been thrown by target of invocation” ,this exception has been raised while getting the subject body and attachment from an email using invoke code activity
Can Someone help me here
Dim outlook As _Application = New Microsoft.Office.Interop.Outlook.Application()
Dim item As MailItem = CType(outlook.CreateItemFromTemplate(in_MsgFile,Type.Missing),MailItem)
out_subject=item.Subject.ToString()
out_body=item.Body.ToString()
Dim ListOfAttachments As New List(Of String)
Dim Count As Integer
Count= item.Attachments.Count
For i As Integer = 1 To Count
item.Attachments(i).SaveAsFile(String.Format(“{0}{1}”,in_FolderToBeSaved,item.Attachments(i).FileName))
ListOfAttachments.Add(String.Format(“{0}{1}”,in_FolderToBeSaved,item.Attachments(i).FileName))
Next i
I have checked them…no null values is passed.
Is there anything else i should check…Cause i have done this for another case where i got the result perfectly. Actually what i am doing is that in a folder i have multiple outlook items i should download all the attachments from the items to the same folder itself. This exception is raised only for one specific case. I have done the same case successfully for another folder containing multiple outlook items