Exchange: Update GAL automatically - exchange-server

I'm working in a small app that needs to integrate contacts into my company Exchange server. I managed to "push" all this contacts into a user contacts list, but I'd need to share this contacts amongst everybody.
My question is: is there a way to automatically add a contact to the GAL, when this contact is added to the user contacts list?
This way, I would push contacts into a "user contact list" (let's say contacts#domain.com), and they would somehow be updated automatically into the GAL (if this makes sense).
So whenever a contact is added into "contacts#domain.com", this will be pushed into the GAL as well.
Unfortunately, there isn't a way to update the GAL trough Exchange Web Services, and after some research I was only able to push contacts into a user contact list, this is the reason why I'm looking for a solution like this.
Thanks for your time

My question is: is there a way to automatically add a contact to the GAL, when this contact is added to the user contacts list?
No when a user adds a contact to their contacts folder in their Mailbox this just creates an Exchange Store item for that user. A GAL contact is an Mail-enabled Active directory object that must be created using the Exchange Admin Console or Exchange management Shell.
You could create a client application that uses EWS to subscribe to a user contact folder (either push,pull or streaming) and then process any new entries and then create the Contact using the EMS new-mailcontact cmdlet https://technet.microsoft.com/en-us/library/bb124519%28v=exchg.150%29.aspx .(you need to build your own logic to avoid duplication etc).
Cheers
Glen

Related

How do I get the memberships (distribution groups) of an Outlook contact programmatically?

Using office Outlook, we can find the 'Memberships' tab when we click and expand a contact, this 'Memberships' tab shows the list of emails that the user is subscribed to.
For example, Employee X (x.x#zcompany.com / id123#zcompany.com) under the Data Department of Z Company is subscribed to the following distribution groups:
datateam#zcompany.com
allemployeees#zcompany.com
dataweekly#zcompany.com
it.uk#zcompany.com
znewsletter#zcompany.com
I would like to get the list of emails the user is subscribed to by inputting either the user's email or user's organization ID.
I found a few potential solutions but do not know exactly how to implement them:
Outlook Interop GetMemberOfList() and GetExchangeDistributionList()
Using Microsoft Graph API
VBA automation for Outlook
Reverse engineering using ExchangePowershell
Using RPA to imitate user actions on Outlook
Wonder if someone with experience doing this can provide some advice? Thanks in advance.
In OOM, call Application.Session.CreateRecipient, Recipient.Resolve, Recipient.AddressEntry.GetExchangeUser(). ExchangeUser exposes GetMemberOfList() method, which returns IAddressEntries object.

Microsoft Exchange Meeting Master Copy

I have a custom application with its own database and a connection to exchange through EWS. Part of this application is a meeting tool which allows users to import exchange meetings and auto invite the other users which also use my application. As part of this tool I need to keep my meetings up to date with exchange, basically maintaining a centralized meeting storage. I can't simply store the user's exchange credentials due to security concerns and I also cannot customize the EWS server in any significant way (ie I cannot add Delegate Access).
The problem is that I am currently simply forcing all users to login to EWS whenever the go to view a meeting's details and it will query EWS to get the details using that user's EWS credentials and access their copy of the meeting. The problem is that there is no guarantee that any user has the same meeting details as any other user. As is partially explained here. Is there any way I can force the EWS FindItem call to only use the meeting's public (master) properties? i.e. Whatever version of the meeting the organizer has sent out/updated. I just need all users to return the same details when they query for the same meeting.
One solution I've considered is adding a 'bot' user whenever a meeting is imported into my application, and then just always using that bot's version of the meeting. However, I would really prefer to do something more 'under the hood' that doesn't require this extraneous user.
Is there any way I can force the EWS FindItem call to only use the meeting's public (master) properties
No FindItem will only every return you information about what is in the Folder your trying to access. You might want to consider using GetUserAvailiblity to check the organiser https://msdn.microsoft.com/en-us/library/aa494212(v=exchg.80).aspx would be the closest. I would say to make your application work correctly is you need an Service account that has been given at least read access to every users calendar, you can then make a call to get the organiser version of the Appointment which will also contain the user responses. If your using Office365 then the new REST Api does facilitate this in a more secure way eg demon apps https://blogs.msdn.microsoft.com/exchangedev/2015/01/21/building-daemon-or-service-apps-with-office-365-mail-calendar-and-contacts-apis-oauth2-client-credential-flow/

Listing all current events using EWS Managed API

Our organization has an Exchange server, where each employee has a calendar. We want to make an application showing a list with the current event for every user. Is this possible using the EWS Managed API?
We also want to add a special icon whenever a user has a birthday. Can I somehow store and retrieve birthdays via Exchange, or do I need to create a birthday config file for my application only?
Answer to your first question "Yes" it is possible using the Managed API.
Yes you can store and retrieve birthdays via extended properties if the calendar doesnt already have one.

How to have two separated contacts with same email address?

Using Exchange 2013 and Outlook 2013, I need to have two separated contacts with same email address. What I've seen is once I create a contact with an email address, for the second contact (even though I choose to create a new contact instead of update the existing one) Outlook merges two contacts details.
Now the question is, is this doable at all? Can I have two or more contacts sharing same email address but having isolated details?
In fact, I'm using ews managed API to do this programmatically, but that doesn't matter because same thing happens by using Outlook directly.
Update: Looks like Outlook 2013 by default links contacts with the same email address. And according to this post Office Community the only way to stop that is changing a registry key!
Now I wonder if it's possible to stop this from Exchange side.
You can turn off Duplicated detection in Outlook in the Option-Contacts, in EWS it shouldn't be doing any duplicate detection, if the contact is in the GAL then it will resolve it to the GAL address. Generally in this case your creating a OneOff Email address for a contact you can ensure that unique by using a different display-name when your create the contact. eg
Contact contact1 = new Contact(service);
contact1.GivenName = "Fred";
contact1.Surname = "Smith";
contact1.EmailAddresses[EmailAddressKey.EmailAddress1] = new EmailAddress("fred smith1", "fsmith#domain.com");
contact1.Save();
Cheers
Glen

How get user contacts list from EWS

I'm developing web application which is similar to address-book,
now I want to create a page with list of user contacts. I already have user email and show out_of_office badge using GetUserOOFSettrings API method.
Does the API for getting user's (favorite) contacts list exists?
E.g. to get MS Lync contacts which user have, or outlook contacts...
Does some better way for implementation of current feature exists?
Thanks
Have a look at https://msdn.microsoft.com/EN-US/library/office/jj190895(v=exchg.150).aspx. Contacts are just items in the user's mailbox. You might also download EWSEditor to poke around and see what's available.

Resources