Answered by:
outllok 2007 attachment size limit

Question
-
In outlook 2007 while trying to add big attachment to email the message box popping up
‘The attachment size exceeds the allowable limit’ How add-in can intercepted the message
before it pops up
Thursday, May 7, 2009 2:13 PM
Answers
-
Could you please share the code sample with me which you are using to add this attachment? It will help us to understand where exactly the problem is arising.
Thanks,
Dhanashri.- Marked as answer by DhanashriModerator Tuesday, June 23, 2009 12:44 AM
Monday, June 8, 2009 10:56 PMModerator
All replies
-
Hi,
Thank you for contacting "Innovate on Office" forum!
We would like to know which programming language/technology you want to use to implement this.We await your response!
Thanks,
Dhanashri.Thursday, May 7, 2009 11:28 PMModerator -
Hi,
Thanks for getting back to me. We are using vb.net VS2008. Building Outlook Add-inFriday, May 8, 2009 12:56 PM -
Hi,
Please refer to below code sample which will warn you before you attchment size exceeds the limit of (10 MB):
private Outlook.Explorer _Explorers;
private Outlook.Inspector _Inspectors;
double TotalAttachSize;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Outlook.Inspectors inspectors = this.Application.Inspectors;
inspectors.NewInspector +=
new Outlook.InspectorsEvents_NewInspectorEventHandler(
Inspectors_NewInspector);
foreach (Outlook.Inspector inspector in inspectors)
{
TotalAttachSize = 0;
Inspectors_NewInspector(inspector);
}
}
void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
{
if (Inspector.CurrentItem is Outlook.MailItem)
{
Outlook.MailItem mail = (Outlook.MailItem)Inspector.CurrentItem;
mail.BeforeAttachmentAdd += new Microsoft.Office.Interop.Outlook.ItemEvents_10_BeforeAttachmentAddEventHandler(mail_BeforeAttachmentAdd);
mail.AttachmentAdd += new Microsoft.Office.Interop.Outlook.ItemEvents_10_AttachmentAddEventHandler(mail_AttachmentAdd);
}
}
void mail_AttachmentAdd(Microsoft.Office.Interop.Outlook.Attachment Attachment)
{
int MB = 1024*1024;
MessageBox.Show(Attachment.Size.ToString() + "\n" + " Now Total Size limit reached is " + TotalAttachSize/MB + " MB");
}
void mail_BeforeAttachmentAdd(Microsoft.Office.Interop.Outlook.Attachment Attachment, ref bool Cancel)
{
TotalAttachSize =TotalAttachSize + Attachment.Size;
if (TotalAttachSize > (1024 * 1024 * 10 ))
{
MessageBox.Show("You have reached the total Attachment Size limit");
return;
}
}
Please let us know if this helps!
Thanks,
Dhanashri.Disclaimer:
By using the following materials or sample code you agree to be bound by the license terms below and the Microsoft Partner Program Agreement the terms of which are incorporated herein by this reference. These license terms are an agreement between Microsoft Corporation (or, if applicable based on where you are located, one of its affiliates) and you. Any materials (other than the sample code) we provide to you are for your internal use only. Any sample code is provided for the purpose of illustration only and is not intended to be used in a production environment. We grant you a nonexclusive, royalty-free right to use and modify the sample code and to reproduce and distribute the object code from the sample code, provided that you agree: (i) to not user Microsoft’s name, logo, or trademarks to market your software product in which the sample code is embedded; (ii) to include a valid copyright notice on your software product in which the sample code is embedded; (iii) to provide on behalf of and for the benefit of your subcontractors a disclaimer of warranties, exclusion of liability for indirect and consequential damages and a reasonable limitation of liability; and (iv) to indemnify, hold harmless, and defend Microsoft, its affiliates and suppliers from and against any third party claims or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of the sample code.
- Edited by DhanashriModerator Thursday, May 21, 2009 2:54 AM
- Proposed as answer by DhanashriModerator Thursday, May 21, 2009 2:55 AM
Thursday, May 21, 2009 2:53 AMModerator -
Thanks. But it's not helpful. Unfortunetly i get "The attachment size exceeds the allowable limit' error msg before
mail_BeforeAttachmentAdd is fired. Which is a problem.
help
AllaTuesday, June 2, 2009 2:05 PM -
Could you please share the code sample with me which you are using to add this attachment? It will help us to understand where exactly the problem is arising.
Thanks,
Dhanashri.- Marked as answer by DhanashriModerator Tuesday, June 23, 2009 12:44 AM
Monday, June 8, 2009 10:56 PMModerator -
Hi,
You misunderstood the problem. Actually I have the same :( , so I will explain it.
1. First of all, update your Office 2007 to SP2 (that error message was added there).
2. You need to connect to exchange server which limits attachment size
3. When you try to attach a file, you immediately get error message "The attachment size exceeds the allowable limit" !!!!
That happens by default, you can't intercept that message before it is shown. NO WAY, except a hack.
MS Team please pay attention to this, because if someone attaches big file doesn't mean he is going to send it. That spoils our workflow :(
Wednesday, June 24, 2009 4:00 PM -
Geektar,I want to suppress this message. Can you share the hack please.Thanks.Sushil.Thursday, February 18, 2010 1:38 PM
-
You should intercept windows messages that create that window. That means you should attach a hook.After that you may only replace that dialog by your own dialog.You can't allow user attach more then it is allowed by exchange server
- Proposed as answer by S.S1 Thursday, February 18, 2010 8:01 PM
Thursday, February 18, 2010 5:04 PM -
Geektar,Thanks for your reply.Do you know how to intercept windows messages that create the window. I am finding hard to track this one down since last coupla days. Appreciate greatly if you can share the code.Thanks.Sushil.Friday, February 19, 2010 9:46 AM