VSTO Identify shared vs User mailbox - outlook

In a VSTO add-in, I am trying to retrieve if the type of the mailbox is shared, user or resource.
I read some interesting posts related to the question and try to look at the OlExchangeStoreType or GetConversation or MailboxType but did not succeed.
I have seen the solution (3) from #DmitryStreblechenko but I would prefer to not use EWS if possible.
It seems that the value that I am looking for is the msExchRecipientTypeDetails.
Any help would be highly appreciated.
Relevant articles
EWS Get mailbox type (user/resource/shared)
MailItem.GetConversation() on shared mailbox
In Outlook Addin, how do I determine if an email's Sender is a shared mailbox email address?
https://www.codeproject.com/Questions/1088741/How-to-list-subfolders-in-inbox-folder-in-shared-e
https://learn.microsoft.com/en-us/answers/questions/612248/in-outlook-addin-how-do-i-determine-that-an-email.html

First of all, VSTO doesn't provide anything for that.
Second, the Outlook object model doesn't differentiate shared/local stores. So, you will not find any property or method for that in the OOM. The best what you could do is to use the Store.ExchangeStoreType property which returns a constant in the OlExchangeStoreType enumeration that indicates the type of an Exchange store.
It is up to you which way/workaround is to use form the list shared above.

You don't need to use EWS - try to read Namespace.AutoDiscoverXml property to check if the shared mailbox and its type are there - you can see it in OutlookSpy (I am its author): click Namespace button, select AutoDiscoverXml property.
Look for the AlternativeMailbox\Type nodes - you can have "Archive", "Delegate", "TeamMailbox".

Related

Changing Account with "on-send" feature?

I have a customer with multiple users, they have two emails accounts on two differents domains.
One is managed by Office365 : Teams / Calendar, example : #my-business.com
Second is for "secure" communication, exemple : #my-secure-email.com
The second one is really not used very often but the emails sent or received must absolutely not go on Office365 (legal reason)
I want to force user to send emails to *.#my-secure-email.com with second account.
With "on-send Feature" i think i can "block" emails but ideally it should be possible to dynamically change the account used in Outlook according to the recipient's address ?
EDIT to clarify :
Is it possible to change sender account with office-js and "on sender" feature on office365 ?
Is it possible to change sender account direclty in Outlook for Windows based on recipient address ?
Thanks
Guldil
Is it possible to change sender account with office-js and "on sender" feature on office365 ?
No, it is not possible. OfficeJS doesn't provide anything for that.
Is it possible to change sender account direclty in Outlook for Windows based on recipient address ?
Yes, you can choose the sender's account in Outlook manually or by using a VSTO add-in instead. The MailItem.SendUsingAccount property is available in the Outlook object model (available for VBA macros and COM based add-ins). The property allows setting an Account object that represents the account under which the MailItem is to be sent.
But web add-ins work under the context of currently selected item only (or in case of UI-less add-ins what they activated for) and don't provide access to application-wide features like choosing email account to send from.
You can post or vote for an existing feature request on Tech Community where they are considered when the Office dev team go through the planning process. Use the github label: Type: product feature request at https://aka.ms/M365dev-suggestions .

How to get itemId of the item you are replying/forwarding to using Office-JS

Is there a way to get the itemId of the item you are replying/forwarding to in compose mode using the Office-JS library or EWS? I want to be able to get the itemid of the email or meeting invite that I am replying/forwarding.
OfficeJS doesn't provide anything for that. Basically your add-in is run under the context of a specific item in Outlook (currently selected). The best what you could do is to use EWS by calling Office.context.mailbox.makeEwsRequestAsync or Graph API (for Office365 users). You may take a look at the EWS - Determine if an e-mail is a reply or has been forwarded thread, you are interested in getting the In-Reply-To field. Note that In-Reply-To is an optional field so it may not always be populated.

Get/change safe senders list and blocked senders list in C# VSTO

I'm working on an Outlook 2010 add-in that needs to prompt users before following a link found in an email. During the process I'd like to offer the user the choice to trust or block the sender of the email, thus I need to access both lists. I realize that Junk/Spam email options are not exposed by Outlook OM. Although I was successful in accomplishing the task using Redemption, unfortunately I'm not allowed to use it by my employer, so I need to find another way. I found this post (Get Safe sender list in Outlook 2007 C# Add in) that points in the direction of either MAPI properties or registry keys.
My preference would be MAPI props, but I'm not sure what object that property belongs to. Would it be the property of the default store?
Outlook.Store obj = Application.Session.DefaultStore;
const string PR_SPAM_TRUSTED_SENDERS_W =
"http://schemas.microsoft.com/mapi/proptag/0x001f0418";
Outlook.PropertyAccessor pa = obj.PropertyAccessor;
string list= pa.GetProperty(PR_SPAM_TRUSTED_SENDERS_W).ToString();
Unfortunately I'm getting an error message (translated to English) like 'Object doesn't have such property'. In production it would have to work with Outlook clients connected to Exchange 2007 mailboxes.
Ok found it. The actual property is called PidTagExtendedRuleMessageCondition and the Blob format is described here MS-OXCSPAM and in MS-OXORULE respectively.

Different Unique Ids created using WebDAV and Exchange vs Outlook

I am creating an appointment in Exchange via WebDAV, but the UId created is not the same as if I create the appointment in Outlook. The UId I believe is the same as the GlobalObjectId and should be unique and not change.
The UId if created via WebDAV is:
CD0000008B9511D182D800C04FB1625DDD67374428B4C644A0A359A2586E30B3
The UId if created through Outlook is:
040000008200E00074C5B7101A82E008000000002005332BA3A8CA01000000000000000010000000DD67374428B4C644A0A359A2586E30B3
If I open the appointment created via WebDAV in Outlook and then save it again the UId changes which is annoying (The UId changes to one above beginning with 04).
The second half of the UIds are the same GUID {DD673744-28B4-C644-A0A3-59A2586E30B3} and never change. The document here http://msdn.microsoft.com/en-us/library/cc425490 (EXCHG.80).aspx explains how the GlobalObjectId is constructed. Outlook seems to follow these rules, but Exchange doesn't. I am using Outlook 2007 and Exchange 2007.
There seems to be a myriad of different ids that can be used to identify appointments and I'm just looking for one that stays the same so I can track the appointment over time.
If anyone can help to explain why this UId changes or a way of creating it so it doesn't change it would be much appreciated. My limitations are supporting Exchange 2003 SP2 and Outlook 2003.
Oh yes Id can change, it can depend on the client and the way that you access the items. It a right PITA
I think the link may should help you though , (not knowing excatly what you are doing).
There are mapi proerties that you can use as well but you may have to explain what you are doing a bit more ... are you only doing WebDav ?
How to use WebDav to match dav:href to Outolook Interop href value

Exchange 2007 master category list

We are constructing an application that will be interacting with Exchange 2007 calendar functions. We will be using the Outlook Redemption Objects dll’s. Our design relies upon the outlook 2007 meeting Category features. We would like to ensure that specific mailboxes have a standard set of category names and colors.
We can’t rely on users to set these up. We also can’t rely on users running the exchange client, many users will be on MAC’s and will be using OWA to manage their calendar.
As I understand it the master category list is stored in each users mailbox in an hidden message in a property named IPM.Configuration.CategoryList. I haven’t found any reference on how to set this yet.
The only things that I have found to help us are:
Group policy objects: http://technet.microsoft.com/en-us/library/cc179073.aspx As I understand this, it won’t manage the color’s and relies upon the exchange client.
A third party tool - http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 The enterprise edition appears to do what we want but is expensive for a once per mailbox operation on 100 or so mailboxes.
Basically, our preferred solution is to be able to produce a script that accepts a mailbox name and sets up a standard master category list.
we were able to accomplish our task using the code at http://gsexdev.blogspot.com/2007/08/adding-categories-to-master-categories.html
AFAIK, the categories for mail box items are stored in local outlook profile and not on the exchange server.Before Ol 2K7, these were stored in registry so I doubt if category master list can be set on E2K7.

Resources