I am trying to create a program that reads my mail from Microsoft Outlook so that I can move them into different folders based on thier contents. I am using Microsoft.Office.Interop.Outlook 12.0, which works fine with Outlook 2007.
How do I handle scenario where another user uses Outlook 2010?
Do you need to use C#? If you don't need to use C#, you can open one of the messages that you need to move and click on "add rule". There you can define rules to, for example, move all mail from your boss into a folder called work. I don't see why you need to use C#. It would be very difficult to do that in C# except simulating mouse movements...
Related
I Want to create custom code that will run when the user decides based on outlook's rules.
so far i checked a few possibilities:
1)Create a custom Action that would be added to the rules actions options - that is not possible according to MS - https://social.msdn.microsoft.com/Forums/vstudio/en-US/1bae2bbc-0ab4-419a-b0d6-7a02195348ce/outlook-custom-action-in-rules-wizard?forum=vsto
2)Run Script based on a rule - built in ability, however i encountered a few issues:
it is not possible to share the script
the macro's have to be enabled each time (disabled again when you restart)
I want to use the C# VSTO add-in in order to overcome those problems:
Is there a way to implant the script and make sure the macro is enabled using a VSTO add-in?
this way users will be able to install the add-in and then chose the script as an action to every rule they create based on the default outlook rules.
You don't need a rule if your code is in a VSTO addin. You can use Items.ItemAdd event on the Inbox folder or Application.NewMailEx event to so anything your please with the newly arrived message.
I am trying to prevent user to copy an encrypted email when it is open to be read.
To restrict right click + Copy I have used contextMenu in CustomUI which is working.
I need to restrict the Keyboard ctrl+c.
Already tried low level hook and it is actually detecting the key strokes.
Detecting text changes in Word 2016 from VSTO add-in
The problem is even if I clear the Clipboard using ClipBoard.SetText(string.Empty) the selected text is getting copied.
I assume the copy operation is happening afterwards.
Any suggestion would be appreciated.
I am using C#, VSTO outlook Addin.
In case anyone comes to this question, I found below helpful
Excel VSTO Key hook
In Visual Studio, I have a solution. In that solution I have 2 projects. One is a VSTO so that we can make a plugin for Excel. The other project is for creating a .xll file so that we can have Custom Functions.
The VSTO helps us create a login system on excel so that they can do certain things.
However, since we only want our users to be able to use our custom functions they have to log in. I think that these 2 projects can't communicate directly so the .xll addin wouldn't know if a user is logged in or not.
Is there anyway for these 2 projects to communicate? Perhaps via a middle-man like a class with static variables?
EDIT:
More information:
Both projects are written in C# code. I was able to do that for the .xll file by using ExcelDNA.
So if there's any way that I can create maybe a C# class that can coordinate or share data between the two projects that would be really great. Since login data isn't the only thing that we want to share.
I'm hoping in the class there would be a static boolean variable holding whether the user is logged in. So the VSTO could set the boolean value and the .xll could get it.
You could add a hidden function [ExcelFunction(IsHidden=true)] to the .xll, which you can call from the VSTO add-in with Application.Run.
I would use a licensing system that let the user validate a licence key. This process can takes place within the VSTO. Then I would use two checks :
if in the VSTO the licence key is validated then load the xll, otherwise do not load it.
within the xll, by using relative path, I would locate and check a second time the licence key (to prevent that the user loads directly the xll).
It just requires to be able to check the licence key in C# (VSTO) and C (Xll), ie to have a validation key algorithm implemented in both languages.
My goal is to create an extension for Outlook 2010 to white-list allowed attachments by their file extension and also enable it to "look into" ZIP attachments to check file extensions inside.
I'm very familiar with coding in C# in the Visual Studio IDE, but I've never done an Outlook (or Office) extension before.
So my first question to people who might have tried it -- is it possible to do what I want?
And if yes, can you suggest any resources on how to program such an extension?
PS. I'm coding this specifically for our office set-up, i.e. Windows 7 (client) with Outlook 2010 as email program.
If you are using Microsoft Exchange, this is controlled by the exchange server, not by the Outlook client. I'm not sure what the restrictions are for other email systems, but I would guess there is usually a server-side filter that would return a "non-deliverable" error if a blocked attachment is found.
You could get around this with your add-in by changing the extension of a blocked file type to something else and adding some sort of note as a .txt attachment or within the message text saying what the original message was. I'll leave design work to you, but it might be nice to have a list where you can add/remove extensions that should be changed to something else.
Once you've set your computer up with the prerequisites for development, I would start here: https://msdn.microsoft.com/en-us/library/bb386094.aspx and browse through the child pages of that topic. I would also take a look at https://msdn.microsoft.com/en-us/library/cc668191.aspx (one of the child pages) for a complete walkthrough.
The Outlook object model doesn't provide anything for filtering attachments. Moreover, it doesn't allow to open attachments on the fly. You need to save the attachment as a file on the disk, see SaveAsFile for more information. Then you can open it for exploring as a regular file. Also you may consider using a low-level API (Extended MAPI) for opening attachments as array of bytes.
All I was wondering if there was a way to run a program and add a spesific email account (with all the correct port settings and whatnot) to outlook2007
I have several users in the feild that seem incapable of doing this themselfs or even doing it with me walking them threw it over the phone
I would love to just email them a program and they run it and it just configures it for them.
How to do this from .net (c#)?
From managed code ther is no way via the OOM but redemption has a Profman lib.
I would also say check out the Office Customization Tool in the 2007 Office system (Ok thats not via code :) but may be simpler for you to use )