Secure storage for user data in Outlook - c#

I need to store some secure data fom my Outlook addin. Is Outlook have sequre storage and how I can access to it by VSTO?

No, Outlook doesn't provide anything for storing the data securely. However, you may consider encrypting your data and then save it in Outlook. For example, you may choose to use a StorageItem for that. See How to: Store Data in a StorageItem for a Solution for more information. Also you may consider using a user property - see the UserProperties property of Outlook items.
In general, all possible options are not restricted by Outlook. You may consider your COM add-in as a regular .Net application so you can use any way you like for storing the data.

Related

Office.context.roamingSettings.get(key) alternative function in VSTO c# project

I am developing a VSTO project where i want to save some user data using roaming settings
i searched for it and it is applicable only in javascript office.js
Is there any alternative that i can use in my VSTO project?
using Outlook = Microsoft.Office.Interop.Outlook;
You can save user settings in the user roaming profile. To add a user setting, go to project properties (right click the project => Properties), then navigate to the "Settings" tab and add your user setting there:
https://learn.microsoft.com/en-us/visualstudio/ide/reference/settings-page-project-designer
JS addin roaming settings are stored in the Exchange mailbox outside of the visible (IPM) folder tree. Outlook itself stores its global settings (e.g., categories etc.) in a hidden message (each folder has two contents tables - regular and hidden) in one of the default folders, such as Inbox or Calendar - you can see those messages in OutlookSpy (I am its author) - click IMAPIFolder button, go to the "Associated Contents" tab.
You can access these message in your VSTO project through MAPIFolder.GetStorage.
You can use hidden items in Outlook. That is how roaming settings are stored by web add-ins. The Outlook object model provides the StorageItem object which is stored at the folder level, allowing it to roam with the account and be available online or offline.
The Outlook object model does not provide any collection object for StorageItem objects. However, you can use Folder.GetTable to obtain a Table with all the hidden items in a Folder, when you specify the TableContents parameter as olHiddenItems. Be aware, if keeping your data private is of a high concern, you should encrypt the data before storing it.
Once you have obtained a StorageItem object, you can do the following to store solution data:
Add attachments to the item for storage.
Use explicit built-in properties of the item such as Body to store custom data.
Add custom properties to the item using UserProperties.Add method. Note that in this case, the optional AddToFolderFields and DisplayFormat arguments of the UserProperties.Add method will be ignored.
Use the PropertyAccessor object to get or set custom properties.
For more information on storing solution data in Outlook see Storing Data for Solutions.

Outlook custom MailTip on MailItem

Is it possible to modify an Outlook MailItem object to display a Mailtip with custom text? It doesn't look to be possible using the OOM, how about at the MAPI layer, i.e. using Redemption?
If not possible, is there some way to achieve a similar effect? (e.g. Ribbon XML, etc.)
mailtip example
The best you can do is add a category - it will be displayed in the same area.
The tip itself comes from Exchange server as a result of an EWS call. There is no way to display custom data there.
I am not sure if you are still interested in possibilities to display MailTips based on your own rules with your own texts: There is an Outlook add-in called MailScout allowing that (mailscout-app.com). Kind regards

Outlook VSTO C# get all MailItems headers without iterate one by one and get property

Is there a way to get all headers of all MailItems in folder fast, without iteration and get property of each item,
I know there is folder GetTable method but it supports only first 255 chars of string, so it's not good for headers.
Nope. The Outlook object model doesn't provide anything for that. What is your final goal?
Note, you can run a secondary thread in Outlook where you can use a low-level code for gathering the required information. Extended MAPI supports multiuthreading. Or you may consider using any third-party wrappers around that API (for example, Redemption). Be aware, you shouldn't use OOM from secondary threads. Outlook will raise an exception if it detects such calls. See multi process in outlook addin for more informaiton.

Strore values in windows Roaming folder in C#

i am developing an Outlook 2013 add-in using C# and MVVM pattern, I have a form where the user must introduce some setting values and I want to store those values in the roaming folder to share them in different machines from which the user may open Outlook. And I donĀ“t know how can I do it. I hope for a little help.
Cheers.
i am developing an Outlook 2013 add-in using C#
You may consider using the StorageItem from the Outlook object model for storing hidden content/settings. A StorageItem object is stored at the folder level, allowing it to roam with the account and be available online or offline.
The Outlook object model does not provide any collection object for StorageItem objects. However, you can use Folder.GetTable to obtain a Table with all the hidden items in a Folder, when you specify the TableContents parameter as olHiddenItems. If keeping your data private is of a high concern, you should encrypt the data before storing it.
Once you have obtained a StorageItem object, you can do the following to store solution data:
Add attachments to the item for storage.
Use explicit built-in properties of the item such as Body to store custom data.
Add custom properties to the item using UserProperties.Add method. Note that in this case, the optional AddToFolderFields and DisplayFormat arguments of the UserProperties.Add method will be ignored.
Use the PropertyAccessor object to get or set custom properties.
The default message class for a new StorageItem is IPM.Storage. If the StorageItem existed as a hidden message in a version of Outlook prior to Microsoft Office Outlook 2007, the message class will remain unchanged. In order to prevent modification of the message class, StorageItem does not expose an explicit MessageClass property.
For more information on storing solution data using the StorageItem object, see Storing Data for Solutions.
You can utilize Application Settings for storing these values. Right-click on your Project, go to Properties, and then Settings to add properties used to configure your program. Let's say you add a property of type String named PropName. To access it, in your code you would simply just type Properties.Settings.Default.PropName to set/get it.

Excel Add In (C#) - How to deal with user settings?

What is the best way to deal with User specific settings with an Application Level Excel 2010 Add In?
In my scenario, a user loads Excel with an Add In installed, this adds a new Ribbon option which allows a Winform to load. The Winform collects a single piece of data and then must attempt to persist that for the current user.
Does Excel provide a mechanism for this? Is the approach similar to vanilla Winforms (i.e. maybe IsolatedStorage)?
Many thanks,
Andy
Use the registry - that's what Excel does for writing various bits of information while it is running. The user's hive of the registry (HKEY_CURRENT_USER) is always accessible, so there are no permissions issues, and it is fast and unintrusive.
.NET has easy access to the registry through the Registry class : http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx.

Categories