.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Sending more than 20 attachments with MAPI in Outlook

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :.NET Framework
Dear All,   I am using MAPI to attach files to a new Outlook email (or any other default email program). It seems that with this method I cannot attach more than 20 files ! Anybody would know why ?   Thanks,   Kalos             <DllImport("MAPI32.DLL" )> _         Private  Shared  Function  MAPISendMail(ByVal  sess As  IntPtr, ByVal  hwnd As  IntPtr, ByVal  message As  MapiMessage, ByVal  flg As  Integer , ByVal  rsv As  Integer ) As  Integer         End  Function         Private  Function  SendMail(ByVal  strSubject As  String , ByVal  strBody As  String , ByVal  how As  Integer ) As  Integer             Dim  msg As  MapiMessage = New  MapiMessage()             msg.subject = strSubject             msg.noteText = strBody          &nb

View Complete Post

More Related Resource Links

DIME: Sending Files, Attachments, and SOAP Messages Via Direct Internet Message Encapsulation


Direct Internet Message Encapsulation (DIME) is a new specification for sending and receiving SOAP messages along with additional attachments, like binary files, XML fragments, and even other SOAP messages, using standard transport protocols like HTTP. In this article, the author explains what DIME is and how it differs from MIME encapsulation. A detailed description of the message format and how it is parsed, as well as working with SOAP and extending it with WSDL, is also included.

Jeannine Hall Gailey

MSDN Magazine December 2002

Error While sending Email using Outlook object in asp.net 4.0


Hi ,

            I am trying to send Email using Outlook object but  it gives following error :

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

I have added outlook reference "using Microsoft.Office.Interop.Outlook"  version

and i am using below code :

Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
            Microsoft.Office.Interop.Outlook._NameSpace oNameSpace = oApp.GetNamespace("MAPI");
            Microsoft.Office.Interop.Outlook.MAPIFolder oOutboxFolder =
            oNameSpace.Logon(null, null, false, false);
            Microsoft.Office.Interop.Outlook._MailItem oMailItem =

Outlook/MAPI Mail Preview Handler

Hey,I am trying to implement the Preview Pane from explorer into my .net application. I have followed http://msdn.microsoft.com/msdnmag/issues/07/01/PreviewHandlers/default.aspx and gotten almost all handlers to work except the preview handler for Outlook email.I lookup the correct CLSID in registry and uses the Activator to create an instance. Wich allso works perfect and it for all other Preview Handler, it also casts well to IPreviewHandler. But unlike other Preview Handlers, i am not able to cast it to one of the two interfaces mentioned by Microsoft IInitializeWithFile or IInitializeWithStream, which are used for loading the file into the preview handler. Do anyone know of another interface used to load files i Preview Handlers? [ComImport] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("8895b1c6-b41f-4c1c-a562-0d564250836f")] interface IPreviewHandler { void SetWindow(IntPtr hwnd, ref RECT rect); void SetRect(ref RECT rect); void DoPreview(); void Unload(); void SetFocus(); void QueryFocus(out IntPtr phwnd); [PreserveSig] uint TranslateAccelerator(ref MSG pmsg); } [ComImport] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("b7d14566-0509-4cce-a71f-0a554233bd9b")] interface IInitializeWithFile { void Initialize([MarshalAs(UnmanagedType.LPWStr)] string pszFilePath, uint grfMode); } [ComImpo

trust outlook 2003 application object when sending email c#

i am using outlook 2003 to send email but this outlook version always not trust application option so that before send email, always prompt a security dialog box to ask me to send email or not. how can i trust all outlook application object using vs 2008 or set in outlook 2003 anyone help

Error on sending Outlook emails

Hi,I am trying to send an email using Outlook in my application. When I run the application in my local machine , it works fine and sends the email using my outlook address. But when I depolyed it onto our server, which is a  Windows Server 2008, it throws an error:Description:            Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.Date/ time:            20100908_03:51:48FullErrorOutput:            System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.   at _Default.SendWelcomeEmails(String email)   at _Default.btnGrant_Command(Object sender, CommandEventArgs e)   at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)   at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)   at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)   a

How can I suppress Outlook 'warning' message when sending email via c#

I am currently using the follow to send email from rich client application - not sure if this is the best solution - lack of knowledge of SMTP authentication, SMTP server etc... and wanted to utilize Exchange.

Microsoft.Office.Interop.Outlook.MailItem mail = (Microsoft.Office.Interop.Outlook.MailItem)
new Microsoft.Office.Interop.Outlook.ApplicationClass().CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
Microsoft.Office.Interop.Outlook.ApplicationClass app = new ApplicationClass();
mail.Attachments.Add(strFileNameLocation, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, 1, strFileNametoAttach);

mail.To = to;
mail.Subject = subject;


Everytime a message has to be send, Outlook throws up a warning message and the user needs to 'authorize' the use of outlook. Is there anyway of suppressing the warning message. 

SmtpClient and Locked File Attachments

Got a note a couple of days ago from a client using one of my generic routines that wraps SmtpClient. Apparently whenever a file has been attached to a message and emailed with SmtpClient the file remains locked after the message has been sent. Oddly this particular issue hasn't cropped up before for me although these routines are in use in a number of applications I've built.

Sending a File Using Email Helper in WebPages/Razor


Note: This is particularly with respect to Email Helper in WebPages/Razor. Please don't post links using System.Net.Mail object.

Following this tutorial: http://www.asp.net/webmatrix/tutorials/9-adding-email-to-your-website

Under "Sending a File Using Email" section what exactly is the code trying to do.

1: The SendFile.cshtml does not have any option to select file.

2: ProcessFile.cshtml is running fine. I am getting the email but no attachement.

I tried changing fileAttachment input to type="file" but not file is being sent to my email. I just get the message send in body.

Question: How exactly this file attachment works using Email Helper in WebPages.

OFFICE UI: New VSTO Features Help You Customize Word And Outlook


See how to use Microsoft Visual Studio Tools for the Microsoft Office System to build powerful custom applications against the 2007 Microsoft Office system.

Steve Fox and Paul Stubbs

MSDN Magazine June 2007

Outlook Add-Ins: Improve Your Outlook With Visual Studio Tools For Office


Microsoft Visual Studio Tools for Office 2003 supported only Microsoft Word and Excel. The new version, however, has the tools you need to create managed code add-ins for Outlook 2003.

John R. Durant

MSDN Magazine March 2006

SQL and Outlook: Enable Database Access and Updates Through Exchange and Any E-mail Client


Using Microsoft technologies, you can insert, edit, query, and delete database entries using any e-mail client such as Hotmail, Outlook, Yahoo, or even WAP phone. While e-mail is certainly a powerful and widely used tool, it is usually not integrated with an application for performing any tasks other than sending reminders. The application scenario described here, an e-mail-based SQL update program, uses a simple data model; however, this solution will apply to any data model that you are working with. It will also eliminate the need for complex n-tier Internet applications and serves as a low maintenance solution for providing data access.

Alok Mehta and Daniel Williams

MSDN Magazine January 2002

Digital Dashboards: Web Parts Integrate with Internet Explorer and Outlook to Build Personal Portals


Digital dashboards gather information and functionalities from a wide variety of sources ranging from Web pages to applications such as Microsoft Outlook and SQL Server, and present the resulting information in a single user interface. Digital dashboards built with the Digital Dashboard Resource Kit (DDRK) are made up of distinct units called Web Parts. Web Parts, introduced with the DDRK 2.01, can contain any Web-based information, are reusable, and integrate with each other and with other dashboards. Creating Web Parts and getting them to work together is illustrated via a sample application that uses a PivotTable view. Integrating Web Parts with Outlook, the Outlook View control, storage, and debugging are also covered.

Maarten Mullender

MSDN Magazine January 2001

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend