Enumerating contacts and calendar events within an Outlook add-in? - outlook

I'm researching requirements for a new Outlook add-in. I'd like to determine if the current version of the JavaScript API allows add-ins to enumerate all of the current user's contacts and calendar events. I need to sync these contacts and events against a third-party system using a REST API.
Is a "get contacts" and/or "get events" (bounded by a date) query possible using the native Outlook add-in JavaScript API?
I'd prefer to do this using the native JavaScript API, but this could be something more suited to an Exchange Web Services call. Something involving makeEwsRequestAsync, perhaps?

The Mailbox API doesn't have any methods for accessing data beyond the context of the current item that the add-in is activated for. So yes, EWS is an option, as well as the Outlook REST APIs.
EWS can be quite difficult to work with, as the XML requests and responses are time consuming to work with (one typo and you're screwed). I would recommend the REST APIs instead.

Related

Outlook Add-in REST API deprecation

We are retrieving the email and attachments using the oAuth token from getCallbackTokenAsync in office.js JavaScript library and sending the token to the web application to retrieve them from EWS (~/EWS/Exchange.asmx) using SOAP request similar to the approach shown in https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/get-attachments-of-an-outlook-item
Could anyone please confirm that the deprecation of Outlook Rest API 2.0 will not affect the existing functionality. I am new to the Outlook add-in development and the documentation seems vast to digest.
https://devblogs.microsoft.com/microsoft365dev/outlook-rest-api-v2-0-deprecation-notice/
Do we need to register the add-in anywhere OR provide any permissions to the add-in specifically for getCallbackTokenAsync method to retrieve the token OR making the SOAP request to download attachments.
EWS remains unchanged for Outlook web add-ins. Make sure that you don't use the isRest option for the getCallbackTokenAsync call.
Take a look at the recent Office add-ins community call where this question was discussed in depth. Here is a screenshot for others:

access contacts in outlook using Script lab

can Oauth be used in script lab(custom made) for authentication and can it be used to access and fetch outlook contacts ?
if yes then how is it possible ?
Outlook web add-ins work under the context of currently selected item in Outlook. So, the ScriptLab add-in was developed for playing with APIs for the current item (OfficeJS) and getting sample pieces of code. If you need to access other items/contacts I'd suggest using MS Graph API instead or EWS (discontinued with a time) as well as Outlook REST API.

Relationship between Outlook JS API and Outlook REST API

I am looking to develop an addin for Outlook using the Office JS API. Reading the API documentation, there are a number of references to making a call to the Outlook REST API to do various things.
As an example, I want to retrieve a list of contacts from the local machine. I have seen posts suggesting I need to make a call to the Outlook REST API, however this doesn't make sense to me. If they are local/offline contacts, why would I need to do that? I feel as though I'm missing some relationship between the two.
A screenshot for the list of contacts I want to retrieve:
Question
Could someone outline how they fit together (if at all)? Is it expected that if I'm going to effectively use this API, I will also need to have my data "online", such that it's available from some REST service?
As the contacts are stored locally it can not be retrieved using REST API. Getting the contacts via Office JS is not possible today. We track Outlook add-in feature requests on ourĀ user-voice page. Please add your request there. Feature requests on user-voice are considered, when we go through our planning process.

Outlook REST API - Application Permissions or Background Services

I'm currently using Microsoft Graph, but have been running into its limitation on the request size. Seeing as how the Outlook REST API doesn't have that limitation and is supposed to be very similar to the Graph API for mail related functions, I wanted to use the Outlook API for sending messages with larger attachments.
But is there a way to get application level permissions with the Outlook REST API? Or make calls without a user? The authentication approach I'm using with Microsoft Graph is the one outlined at https://learn.microsoft.com/en-us/graph/auth-v2-service and it would be nice to be able to do the same with the Outlook API.
My app is registered at the Microsoft Application Registration Portal, but the permissions there are only for Microsoft Graph. I have seen an article that mentions being able to edit the manifest in order to get permissions working with other APIs (like the Outlook API), but wasn't too sure about that.

Accessing Appointments in Outlook without ActiveX

I'm currently working on a project where I'm sending and updating Appointsments. I would like to do this without the use of ActiveX since I don't want to be limited to IE. I've been googeling for quite some time now, but I couldn't find anything that helped, so here's my question. Is there any way I can access or update appointments without the use of ActiveX.
We also have access to the OutlookWebApp, so maybe there's an interface there. Would be great if someone had an idea. Thanks in advance and
Greetings Chris
You can use Exchange Web Services (web or desktop app) or the EWS Managed API (desktop app only) to access data in Exchange Mailboxes: https://msdn.microsoft.com/en-us/library/office/jj162981.aspx.
If you are working with Office 365 mailboxes you can use the Outlook REST or Microsoft Graph APIs: https://dev.outlook.com/
If your solution requires a UI in Outlook Online (OWA) then you can access contextual data (i.e. the current email or appointment) with an Outlook Add-in (you can use EWS requests from it as well): https://dev.outlook.com/reference/add-ins/

Resources