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.
Related
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.
I am using the excellent example at CodeProject to read .MSG files however many are coming back with no body text. I have stepped into the code and I believe this is because the property key __substg1.0_1000 of the Outlook message does not exist (GetMapiPropertyFromStreamOrStorage() method of Outlook Storage) in the message properties.
Do I need to look for an alternate property key to read the message body from these emails and if so what is it? Is there another way around this?
I'm not near a computer, well, I guess my phone is sort of a computer, but are you sure they're emails? Calendar and contact items generally won't have that property.
PidTagBody, PidTagHtmlBody, and PidTagRtfBody(?) are all properties that can contain body information. However, if there is an HTML or rtf body, you will almost always have PidTagBody property populated.
You can check the PidTagMessageClass property to determine if its an email, note, contact, etc. An email will have the value "IPM.Note". You'll have to look up the property ids for these names yourself, at least until I can get near a computer.
How can I get a reference to the MailItem for a message taken from an Outlook table? If I generate a table which contains rows with messages and tell it to add the column with messages' EntryID, the EntryID is not the same one as the one I can see for the same message when I simply loop through the folder's Items list.
Is there any other way to get the message?
I'm using Outlook 2007 and 2010. Thanks in advance.
If your store is an Exchange mailbox, then the table will return short-term entry IDs for the PR_ENTRYID property. These entry IDs are valid for the current session, but should not be persisted. To force the table to return long-term IDs, request the PR_LONGTERM_ENTRYID_FROM_TABLE (0x66700102) property instead; however, be careful that this property will be absent for PST providers.
Reference: MAPI Tables by Dmitry Streblechenko
I am looking for a solution to the following problem:
My manager wants to automatically send a second message when he sends an email to X and there is no response in two days. If there is no further response in 2 more days, send another message.
Before I start building anything, I wonder if there is already a product/solution that does that? Can anybody recommend an already existing tool?
We use MS Exchange and he uses Outlook 2007.
Auto Follow Up is a tool I've used in the past for this specific purpose. Also, always check www.slipstick.com for listings of Outlook/Exchange add-ins - they seem to be the best source (disclaimer: I have no affiliation with that site or any of its add-ins)
It's not an existing solution, but in case you don't get any answers:
You can use Exchange Web Services to do this: pointing it at his Sent Items folder. So this is basically what you would do:
Use SyncFolderItems against his Sent Items, say every 1 hour. The first time you do this use null as the SyncState, thereafter use the last SyncState the server sent you.
Write them to a SQL table: { ItemId NVARCHAR(MAX), ChangeKey NVARCHAR(MAX), MessageID NVARCHAR(MAX), Sent DATETIME }. MessageID would be the Message-ID header from the message.
Run a query (say once a day) that selects the rows where the Sent value is more than 2 days ago.
Use GetItem to retrieve the original mail and resend (first clearing/deleting Message-ID) it using SendItem.
Delete the selected rows.
These items will land up in the Sent Items folder and will be picked up by your application (as they are actually new mails); and re-processed in 2 days.
Use SyncFolderItems against his Inbox, again maybe every hour (maybe immediately after the first operation against Sent Items). Keep a unique SyncState for this operation.
Grab the In-Reply-To header. Delete any rows with a maching MessageID.
Grab the References header; and split it into a list. Delete any rows with a matching MessageID.
Would this solve your problem:
http://www.followupthen.com/
Perhaps not exactly what you want and it isn't integrated into Outlook.
I don't think you will find exactly what you want. This is functionality which belongs to a CRM, not to email software.
Having said that, the Getting Things Done Outlook Add-In will get you in that direction. It won't automatically send a follow up mail, but it can take care of a notification so you send it yourself. (but this plugin is not free - $75 - you have to decide yourself if that's worth it)
With the GTD add-in you can send a mail, and select the option "Send and Action". After pressing send mail, you can select the action "#Waiting For", and press ok. Now it will create an outlook task, with the subject and contents of the email you sent automatically filled. You can set all the task properties, like end date and notification time.
After two days at the notification time, you get a (default) outlook popup, where you can open the task. With one click you can open the corresponding email and use reply or forward to send your followup. You can create a new task or modify the existing task for the next followup.
If you receive a reply in the mean time, and open the mail, you can use the "related task" button to find the corresponding task to mark it as complete. It also adds buttons like defer and delegate to your mail.
There is a 30-day trial. I am not connected to netcentrics, but I have bought and use this plugin.
Have you looked into automating Outlook using Visual Basic for Applications? If you aren't familiar with VBA, or if the thought of writing VBA gives you nightmares (I've had a few), then you might find some example VBA code on the web that accomplishes something similar to what you are trying to do, and then you could just tweak it. I know you said that you wanted an existing tool, but I thought I would throw this out there as a sort of last resort. It's not ideal, but I'm pretty sure it would solve your problem.
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).