Exchange EWS: class "DistinguishedFolderIdType" not defined - exchangewebservices

I'm using Exchange web services, trying to create a calendar entry in another user's mailbox. My account in EWS has rights to do this, and I can successfully use Impersonation to create thes appointment in any mailbox.
However, some examples I've seen of doing this, use an instance of DistinguishedFolderIdType, not impersonation, to set the mailbox for the appointment.
Problem is, this class simply isn't appearing in my installation of the EWS SDK for Visual Studio. It's v1.1, obtained here, but can't be found in Object Explorer. What am I missing?

The type DistinguishedFolderIdType is not part of the EWS Managed API.
If you do not use the EWS Managed API but generate your own SOAP client proxy manually from Visual Studio by adding a reference to the EWS .asmx service, the generated proxy will contain DistinguishedFolderIdType.
However, depending on what you are trying to accomplish, you should be able to do it using the classes provided på EWS Managed API 1.1 and you won't need DistinguishedFolderIdType.

Related

How do i create api keys for users on my client instead of developer portal offered in azure api management?

I have an enpoint in my MERN app which I would like to expose to developers.
I came across APIM and would like to use it.
After going to the documentation I would like to know how do I can use APIM for my specific enpoint and where I allow users to generate API's in my client side react app.
I am also going through the API management API. but don't know how to generate user specific API keys...
You could simply mimic what the Developer Portal does using APIMs REST API.
If you are using the Consumption Tier of APIM, you can just create a standalone subscription using the Create or Update Subscription API. Yon don't have to set properties.ownerId in the request payload here.
On the other tiers, standalone subscriptions are not supported yet (but will be as mentioned in the official announcement blog under New Features), so you will have to create a user first using the Create or Update User API and then create a new subscription mentioning this user under properties.ownerId as /users/{userId}.
Since these REST APIs call the Azure Management API, you shouldn't be making these requests from the client and instead should be calling this from your backend.

Use token from Outlook web add-in for EWS write operations

Is it possible to use any tokens from an Outlook add-in for use with authenticating EWS Managed API operations that create or update items?
Apparently the token returned from mailbox.getCallbackTokenAsync can only be used in read operations. I can indeed verify that is a problem because attempts to send emails or call UserConfiguration.Update result in an error:
The requested web method is unavailable to this caller or application.
I have been testing these methods from an ASP.NET Web API App Service in Azure, called from JavaScript in the Outlook add-in.
Apparently mailbox.getUserIdentityTokenAsync can be used to validate a user, but it is not clear if that can be used in conjunction with OAuthCredentials for ExchangeService.Credentials.
Are there any options here? I cannot ask the user for their username and password to authenticate with Exchange. I am certainly willing to use Graph or the Mail API, but AFAIK there are no ways to update user configuration items with those APIs.
You're looking for makeEwsRequestAsync(). Both CreateItem and UpdateItem operations are supported makeEwsRequestAsync.
You can find the full list of supported EWS operations in the documentation under EWS operations that add-ins support.
There is also support for calling into Microsoft Graph via the add-in but as you noted, Microsoft Graph supports a very limited number mailbox configuration options.

Using EWS SOAP requests in an Outlook web add-in

I need to use several EWS requests (e.g. GetUserConfiguration, UpdateUserConfiguration) that are not supported using Office.context.mailbox.makeEwsRequestAsync.
I cannot use the EWS Managed API in my own web service as a broker, and must use XML SOAP requests directly from the add-in's JavaScript (those methods are not available in the Graph or Mail APIs).
There are many examples (like this) showing how getUserIdentityTokenAsync can be used to pass that token to your web service (again, which I can't use) to use there in whatever way you need it.
However, I'm guessing the token retrieved from getUserIdentityTokenAsync is different and cannot be used. As a simple and hopefully appropriate test, I obtained an OAUTH token for my O365 account and used that as the token using SOAPe for a test GetUserConfiguration call and it worked. I then tried using the token from getUserIdentityTokenAsync and it didn't work (401 Unauthorized).
I concede that this may be a poor test, and I admit that at this point it is unclear to me how a SOAP EWS request from JavaScript in an Outlook dd-in can be authenticated without requiring an explicit user login (hopefully it can). And if it can, how do I get the token I need and how do I use it for this kind of client-side request?
You may want to use ews-javascript-api helper in this case. here is the example on how to use this with Outlook Add-ins.
https://github.com/gautamsi/ews-js-api-browser#working-with-plain-jsts-no-module-loadersbundlers
you may use any allowed api (available in makeEwsRequestAsync) with this library. with similar api what is available in Ews managed Api.

How to search items across folders in office 365 using EWS Java API

I'm trying to search items across folders in office 365 using EWS Java API.
I'm using EWS Java API 1.3 version (https://github.com/OfficeDev/ews-java-api)
I have seen the following link and tried like that in Java but still this one also not working
Exchange Web Services (EWS) FindItems within All Folders
Regards
Ramesh
In 2013 and Office365 the best thing to use to search a Mailbox is eDiscovery which you can use from EWS http://msdn.microsoft.com/en-us/library/office/jj190897(v=exchg.150).aspx . There is nothing in the Java API to use the eDiscovery SOAP operations so you would need to either build those yourself or use raw SOAP or generate some proxyclass to use it.
Cheers
Glen

Which one is better EWS API or EWS managed API?

I am developing email client for exchange server ....... I came across EWS and EWS Managed API. Please help me understand which one I should go for ?
If you are:
Using .Net and the functionality is implemented in the EWS Managed API....use the EWS Managed API.
Using .Net and the functionality is not implemented in the EWS Managed API....use the EWS Managed API to discover the EWS endpoint, and then code directly against EWS or use a proxy object model generator.
Using Java (not Android), use the EWS Java API. Note that this isn't actively updated, but you have access to the source.
For everything else, look to see if there are client implementations available. For example, you could evaluate IndependentSoft's client implementation (this is not an endorsement, this is just me giving an option). If not, you should implement Autodiscover and the EWS client.