Bypass "Program is trying to access ... Outlook" Dialog Box - c#

I'm facing one issue while writing Office Outlook 2007 Add-In, I'm accessing the email contents of email currently being sent by capturing Send event. Everything works fine but when accessing the subject/body of the email through Outlook.MailItem object (in C#), it prompts a dialog box to allow/deny this program to access. Can anyone help how to bypass this dialog box and allow the program to access MailItem ?
Thanks
Safiullah

I don think it is possible, MSFT has placed this alert box to avoid an illegal mail box access by malicious program... However, following guys claim that they can by-pass:
http://www.ablebits.com/programming-outlook-security/index.php

Related

Outlook is randomly deleting attachment(s) from mailitem during item send event

I'm currently experiencing some strange behavior when sending e-mails using Outlook (Office 365 Pro Plus).
Our software can generate e-mails and show a new mail compose to the user with attachments which they selected from our software. (We use both Redemption from our software as Outlook Object Model using an Outlook Add-in Express add-in)
Below you can find the code for generating the e-mail using Redemption:
bool createEmail = false;
RDOSession session = new RDOSession();
session.Logon("", "", false, false, null, false);
RDOFolder folder = session.GetDefaultFolder(rdoDefaultFolders.olFolderDrafts);
RDOMail mail = folder.Items.Add("IPM.Note");
... Code for selecting receivers (returns string with emailadresses) ...
... Code for converting word documents to PDF / Adding the attachments to the mailitem ...
RDOUserProperty userProp = mail.UserProperties.Add("DMS_AttachmentCount", rdoUserPropertyType.olInteger, false, false);
userProp.Value = mail.Attachments.Count;
mail.Display();
I noticed that I'm not using
mail.Save();
Could that be the issue?
When we show the user the generated e-mail all attachments are in place and the user is able to open the attachments.
So far so good...
Here comes the problem:
On sending the e-mail, sometimes (i mean really sometimes) some of the
attachments are deleted from the e-mail. When the user goes to it's
sent items and selects the e-mail, some of the attachments are
deleted.
Since this occurs randomly, I'm not able to debug this issue.
What have I tried already:
Turn off ESET Nod32 and all of it's e-mail components
Disabled Office Secured Mode
Exclude certain file extensions from being scanned.
Checked for third party add-ins, so far only the list below is installed
The rest of the add-ins are default by Outlook
My question(s):
Is there somebody out there that has experienced the same problem?
How can I determine what happens inside the Item Send event?
What else can I turn off or apply on the server that might prevent this issue from happening?
Thanks.

Setting Outlook signature for multiple accounts

I am in the process of writing an application that sets a signature based on pre-acquired data for each Microsoft Outlook account(a user may have multiple Outlook accounts for various purposes).
I am able to set a signature for the default account, but I have yet to find how to set a signature for each Outlook account individually. I have done a lot of my own research and poked around the Microsoft.Office.Interop objects without much luck.
Is there a way to achieve this?
To choose the Outlook profile programmatically, you just use
Microsoft.Office.Interop.Outlook.Application App =
new Microsoft.Office.Interop.Outlook.Application();
NameSpace mapi = App.GetNamespace("MAPI");
mapi.Logon(profileName);
obviously setting the profileName to what is shown in the dropdown list upon starting Outlook (if you do not set a default profile in the control panel email settings).
This however is problematic in a number of ways since Outlook does not support multiple sessions even though the MAPI logon does:
http://msdn.microsoft.com/en-us/library/bb219914(v=office.12).aspx
Meaning: if Outlook is already running, you can even set NewSession to true, but it won't help. It will give you the currently-logged-in profile regardless of what name you set. If you have an Outlook zombie (I got that while testing, check with task manager), i.e. an Outlook without an UI showing up, the problem is the same.
If you can ensure Outlook does not run while doing stuff with signatures, you should be fine though.

How to create Outlook's new mail window with attachement in?

I'd like add to my app function allowing sending email via Outlook same as eg Adobe Reader does.
So after pressing email button I'd like to see Outlook's native 'new mail' window with my document attached in.
Any idea how to archive that?
Why not interop?
http://support.microsoft.com/kb/819398
Not quite a solution, but more of a hint: maybe creating an *.eml file with your attachment and opening it (as a new mail window) would help?

C# and Lotus notes attachment icon

I am using C# and need to attach a lnk (shortcut/link) file and email it to a lotus notes account. The problem is the icon defaults to a generic image and does not show the folder with the arrow as seen in Windows Explorer. A txt file icon does display as expected. I would like to control the appearance of that icon after it has been received. Can this be done through C# or is the Notes server the problem?
I think you are asking how to control the appearance of the icon once it arrives in the recipient's mail.
I do remember (from when we were on Notes here at work) that the icon was specific to the sender as opposed to the recipient (i.e. if I send you a Word document and I have Word 97 installed and you have 2003 installed, you'll see the Word 97 doc icon). But this appeared to be a function of the fact that I, the sender, was using Notes as the sending client. However, I think you may not be able to do what you want to do as one would assume you are sending regular SMTP e-mail. Assuming you are sending e-mail through the Notes server's SMTP interface, I don't believe you'll be able to control how the link appears on the recipient's side.

C# opening up a blank email with an attachment using Exchange

I'm new to the world of C# programming but was hoping someone could help me out.
I'm trying to use C# to open up a blank email in Outlook with a specified attachment.
In other words, open the email, the TO: and SUBJECT: fields are blank but the email has an attachment that is specified in my code. I want my user to be able to modify the email and send to whatever users s/he specifies. I know for sure that we have Exchange....so any ideas?
There are a number of way you can do this.
Create an Outlook addin that opens a new mail with the attachment you want via say a new toolbar button.
Do the same in Outlook VBA macro ..
Also you could create a new form with the attachment in it already and then just us that form.(but the attachment will be hard coded etc.)
Does the attachment change ? or is it the same one evey time ? what outlook version are you using ? What are you programing capabilties ?
76mel
I don't think exchange will help you much, you need to work with outlook on the users machine. You can add a reference to the Outlook interop assemblies, should be in the Com tab of your add references dialog.
Here's some links to jump start you.
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.aspx
http://www.microeye.com/resources/res_tech_vsnet.htm
Good Luck!

Categories

Resources