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.
Related
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.
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.
Whenever an email is sent, I want someaction to be performed(we active this action by clicking some button that appears in the ribbon in the compose email window).
I think this action need to be performed from sent items.
So, I want to create a table or a simple list that stores the ids(or something unique) while sending an email. And then whenever an email appears in sent folder, I will check if it is in the list or table that we created previously.
So,
How to create, add data to those tables?
Is this a good way to perform action on the sent items ?
Is there any unique and common element(like some id) between compose email 'mailitem' and sent emails 'mailitem' ?
Thanks.
What tables are you talking about?
It is up to you when to perform an action. I don't see enough information in your post to suggest something else. If you want to get a valuable feedback I'd recommend describing your final goal in depth. However, you may also consider handling the ItemSend event of the Application class.
Outlook uses the EntryID property value (string) to identify items. Here is what MSDN states for the entry IDs:
A MAPI store provider assigns a unique ID string when an item is created in its store. Therefore, the EntryID property is not set for an Outlook item until it is saved or sent. The Entry ID changes when an item is moved into another store, for example, from your Inbox to a Microsoft Exchange Server public folder, or from one Personal Folders (.pst) file to another .pst file. Solutions should not depend on the EntryID property to be unique unless items will not be moved.
But you are free to add your own IDs. You can use user properties to store them. See the corresponding property (UserProperties) of Outlook items for more information.
You can add a user property (MailItem.UserPropertiers.Add) when a message is composed, and then look for a message with that property in the Sent Items folder. In general, you cannot use the EntryID property since it changes when a message is moved from one folder to another (PST provider is the only exception)..
You can store your list/table as a user property on a hidden message in any folder of your choosing, e.g. the Inbox. See MAPIFolder.GetStorage on MSDN. You can see existing Outlook's hidden messages in OutlookSpy (I am its author) - go to the Inbox folder, click IMAPIFolder button on the OutlookSpy toolbar, go to the "Associated Contents" tab, double click on any of the hidden messages to see it properties.
is it possible in Sharepoint 2010 set a permission on a document in order to allow a specific user to view this document (when viewing the documents of a specific document library for example) without giving him the privilege to open it?
For example, [user1] can see that in the list of documents of document library [DocLib1] there is a document called [doc1.docx], but [user1] doesn't have the permission to open[doc1.docx] and view its content.
Technically raymund's answer is obscurity instead of security. If you are going to go that route you can simply update your primary view to remove any links to the document. and create a seperate view for those authorized.
Edit***
after double checking msdn, I found the user permissions article. This shows that there are in deed two seperate permission levels - view items and open items. unfortunately view items is dependent upon the open items permission level, therefore unable to really accomplish your goal.
http://technet.microsoft.com/en-us/library/cc288074.aspx
You can do this by creating a SOAP Service Connection in Sharepoint Designer
Then using your Document List as the source (declaring a login on the login tab with a privilage to tread the list) , then displaying it as a dataview in a sharpoint form.
I have a similar sample here which has a better explanation using a list instead (I should work the same with document library as they are exposed both as lists).
Background
I want to put a lookup field in sharepoint list that will point to a folder. Thats the easy part, but I want user to be pointed to folder contents (not the folder properties) after clicking on the link. It's not possible from the sharepoint interface so I'm trying to create custom field type.
Question
What method should I overload in SPFieldLookup derived class (or anywhere else :P) to be able to point user to folder contents?
P.S. Please don't suggest creating a hyperlink field cause the link will break under different access mappings.
Instead of a custom field, I would consider a computed field (search for "computed" here) and keep your current lookup field. The computed field is simply a UI representation of a column. That is how SharePoint does Title, Title with link, Title with menu, etc. Those aren't multiple columns, just multiple ways to view the same data.
To use this approach you need to be able to build your link from the data available to you. We have done this using custom RESTful web services when the data is not immediately available.