How get user contacts list from EWS - exchange-server

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.

Related

Outlook / Exchange API (Microsoft Graph?)

I am making a quick program that can check another users Outlook calendar and book an appointment. The booking part is fine, but I am looking at a way to return other users calendar information, without having to link a calendar to Outlook first.
I was thinking that there would be an API or a way to access this information either via 365 or the exchange server. There is this (https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/?redirectedfrom=MSDN#Getevents) but it doesn't seem to do what I am after and is also deprecated with an end date within a year
I have read about Microsoft Graph but in reading it refers to 'users calendar', can this do calendars for a specific user that isn't me?
GET /me/calendar/calendarView?startDateTime={start_datetime}&endDateTime={end_datetime}
If so, does anyone know how?
Thank you
You can access user's calendar by calling the following endpoint
GET /users/{id | userPrincipalName}/calendarView?startDateTime={start_datetime}&endDateTime={end_datetime}
Resource:
List calendarView

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.

Can't get a list owned by me in Google Calendar API

Using Google Calendar API v3 to get the calendar list.
However, some users are not able to retrieve their own owner's calendar.
I tried using the Try this API for CalendarList#list to retrieve it,
but it did not return the owner's calendar.
https://developers.google.com/calendar/v3/reference/calendarList/list
However, if the user specifies calendarId as primary in CalendarList#get,
it can be retrieved successfully.
https://developers.google.com/calendar/v3/reference/calendarList/get
Do you have any advice for me?
Can't get a list owned by me in Google Calendar API
Answer: There is no endpoint which will return a full list of all calendars Owned or that the user simply has access to. As this endpoint does not exist the answer to your question is you cant so its working as intended.
In actually you have misunderstood what the calendarlist is. See below
What is calendarList and how does it work?
The calendarList.List is mealy the list that appears on the bottom left hand side of the UI window. There is no guarantee that a user will have anything in this list as it depends upon how the user added the calendar to the list in the first place. The user could also have deleted it form the list. The UI tends to do it automatically but if it was added programmaticlly it will probably not appear it the users calendarlist. So you should not be relying upon the calendarlist to contain a list of all the calendars a user has access to. please see Events and calendars
All users do however have a primary calendar you can always do calender.get on primary and you will get back the primary calendar for that user.

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.

Exchange: Update GAL automatically

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

Resources