I am able to add attachments now from the memory stream .. but I am having problems with certain types of attachments.
Here is the code I am using .. perhaps you can let me know if it is a syntax error or what I need to do to fix it. Thanks ..
If AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Xlsx
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/ms-excel" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Xls
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/msexcel" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Xls
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/vnd.ms-excel" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Xls
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/vnd.openxmlformats-officedocument.presentationml.presentation" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Pptx
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/ppt" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Ppt
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/msppt" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Ppt
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/ms-ppt" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Ppt
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/pdf" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Pdf
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "text/plain" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Unknown
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/text/javascript" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Unknown
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/text/richtext" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Unknown
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Docx
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/msword" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Doc
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/ms-word" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Doc
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/vnd.openxmlformats-officedocument.presentationml.presentation" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Ppt
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "application/zip" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Unknown
ElseIf AttachmentsView.Table.Rows(_icount).Item(1).ToString = "vnd.visio" Then
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Unknown
Else
AttachmentsSheet.OleObjects(_index).FileType = OleFileType.Unknown
End If