How to determine where a Mailitem is being opened from in Outlook 2007 using VSTO 2005 SE - vsto

I have an Outlook 2007 Add-in in VSTO 2005 SE that allows users to save e-mails into our document management system. From within our system users are able to open e-mails they have previously saved. However, when doing so I need to try and prevent them from saving them again.
I am trying to figure out how to determine if the Mailitem being opened is coming from the Outlook e-mail client or from an external source.
I know that normally the EntryId Property of the Mailitem is null or empty string when a Mailitem has not been previously saved in Outlook, however, it seems like when a Mailitem is being opened from within our system the EntryID is not null.

Adam,
Normally most DM systems set mapi properties or user properties on the mail items as they get saved ... DOCID etc. from the DM system. I would get outlook spy and hunt around on the DM emails to try and find this Property. Then you will be able to test for that in your VSTO add in. Failing that, may be you can explain how you open the email from you DM system is from inside outlook via a DM plug in ? or is it totally external app?
What DM System is it ?
Marcus

Related

Assign folder permissions in Outlook 2010 with VBA

Morning,
I'm trying to identify a way of updating permissions to an Outlook 2010 inbox and all of its subfolders with VBA.
We have an account with a large amount of subfolders that several new users need access to. To assign each of these manually will take hours and I'm looking for an automated process, as this will be a reoccuring task.
Due to administrator restrictions I'm only able to use native VBA.
Is this possible, or am I doomed to hours of mundane repetitive pointing and clicking?
Many thanks
Pete
The Outlook object model (used in VBA) doesn't provide anything for changing folder permissions.
You can use a low-level API - Extended MAPI for accessing permissions. Folder level permissions are stored in folders. You need to get the PR_ACL_TABLE property value using the IMAPIFolder::OpenProperty method. Or you may consider using any third-party wrappers around that API that simplify the dev process. See Changes in Outlook 2010 folder permissions not shown in Active Directory for more information.
Since you are using VBA, Extended MAPI is out of the question (you'd need C++ or Delphi).
If using Redemption is an option (I am its author), you can use its RDOACL object (returned by RDOFolder.ACL property) to manage any Exchange folder permissions:
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Folder = Session.GetDefaultFolder(olFolderCalendar)
'make sure we get back an Exchange user
set AddressEntry = Session.AddressBook.GAL.ResolveName("Pete")
set ACE = Folder.ACL.Add(AddressEntry)
ACE.Rights = ROLE_PUBLISH_EDITOR

Outlook 2010 VBA code to copy only certain appointments from a shared calendar to another persons calendar that i have access to

I am at the copy and edit stage of using VBA and have searched and searched for a code which gets me close but I am used to using VBA for excel not for outlook.
I have a shared calendar which many people add to (internally), once this is complete at the end of the day the appointments relevant to certain external people are added to their calendars, at the moment this is done by manually copying the appointments to the external peoples calendars.
It there a way to write some code which will do this automatically?
All calendars are on outlook and shared via exchange.
Any help is appreciated.
Jon
The Namespace class provides the GetSharedDefaultFolder method which returns a Folder object that represents the specified default folder for the specified user. So, you can access a shared calendar and copy/move items. To get the job done you need to use the Copy and Move methods in the following way, a raw sketch:
Set myCopiedItem = myItem.Copy
myCopiedItem.Move myNewFolder
Finally, you may find the Getting Started with VBA in Outlook 2010 article in MSDN helpful.

vb.net addin outlook positem

I am working with vb.net addin outlook 2010. I have an exchange server 2003. We have a public folder that is used to store client emails. Our system send emails to clients and when they reply, it is saved in a public as a postItem not mailItem. I do not know how that happen.
I need to convert that postItem into mailItem because I want to start a workflow with that message.
I am able to get most of the field from PostItem, but I am not able to get CC and TO. I do not know what property from PostItem keep that information.
Are you actually copying data? HAve you tried to just reset the MessageClass property from IPM.Post to IPM.Note?
The Outlook PostItem does not have CC or BCC properties.
I just look at the MSDN reference and I don't see TO field either.
Here is the PostItem documentation:
http://msdn.microsoft.com/en-us/library/office/ff865387.aspx
Without seeing your code, I have no idea why your received email saves as PostItem.
Can you post the routine that saves to the public Exchange folder?

Getting messageID from email in Outlook VBA 2003

Is there a easy way to get the current shown (preferably selected) message-ID via VBA ?
without having to buy Redemption or some other package..
I need to message ID so I can make a link to a web-application that reads the mail and does some other stuff with it
Can't seem to use MAPI or PropertyAccessor in outlook 2003..
Do you mean the unique ID for the message? Try the EntryID Property:
ActiveExplorer.Selection.Item(1).EntryID
FYI PropertyAccessor was added in Outlook 2007, you wouldn't see it in 2003.

Outlook VSTO attach meta data

I am writing an Outlook addin that inserts content into an email, and I have a emailSent event that I would like send an event back to my server letting me know some content was shared.
Is there a way to attach some meta information to the email (or the word doc, which is what you are creating in outlook) so that I can grab that meta info so I can send it back to my server.
Right now, the only way I think I can do it is to search through the email on the send event looking for my content with regex and pull out the info i need, but that seems cumbersome, and also means I need to run the regex for every email sent, even when they haven't added my content.
There is the concept of MAPI user properties, which you can add to an Outlook item. Since Office 2007 the object model allows access to them. If your add-in must run also with older Outlook version, you should recurr to use Redemption (which I prefer also for higher office versions because it has more flexibility, albeit a greater footprint in distribution).
See UserProperties Interface on MSDN.