Create a shared mailbox in Exchange through an API - exchange-server

I'm developing an API that should be able to create a shared mailbox in exchange. So far the only documentation I found around this is here https://learn.microsoft.com/en-us/powershell/module/exchange/new-mailbox?view=exchange-ps, and this uses PowerShell. Invoking PowerShell from an API is not easy, I'm wondering if there is a direct API call I can use for this, preferably MSGraph (I did some searching on this but could not find an endpoint)

Related

Is there a way to connect to Exchange Online using Logic Apps? Do I need to use a REST-api or EWS?

i'm quite new to Logic Apps. I got the task to make an auto reply function within Logic Apps that integrates with Exchange Online. Now I already performed this task using Outlook, but I have to be able to apply it to multiple mailboxes or even the entire company using Exchange. I'm about to get access to the Exchange Admin Center soon, but I don't really know how to start due to the fact that there is no simple way to make a connection to Exchange using Logic Apps. After some research, I think it's necessary for me to somehow make use of a REST API (I also read about the use of Exchange Web Services) to get the information I need, but my knowledge about this is quite small. I guess I'm gonna have to use a program like Postman to request information, so that I can start creating Custom Connectors to Exchange. If anybody has some understanding about this, feel free to reply and help me out! I will forever be gratefull!
There are several different approaches you could take to this if you (or probably they in your case) want your logic app to do all the work then you should use the Graph API rather then EWS (while its possible because its older API you'll loose marks on your assignment) have a look at http://martink.me/articles/using-microsoft-graph-in-logic-apps which covers the basics of what to do. To Get access to mailboxes tenant wide then you need to assigned Application Permission and get certificate (and store that in the KeyVault on Azure etc).
You can do this using Inbox Rules https://learn.microsoft.com/en-us/graph/api/mailfolder-post-messagerules?view=graph-rest-1.0&tabs=http and the Exchange Server will do all the work when it comes to doing the Auto-response (and has loop detection logic already) and your logic app then just need to do the Creation and management of the Rules.
But I would suggest you clarify with the person who assigned you the task whether they want the logic app to do the response (eg using the Graph API) or if its okay for the Exchange Server to do this for then (which should be more reliable).
You can also create Rules via the Exchange Admin Center and you could probably also through in Power Automate into the mix to do Autoresponse's so I'd clarify what they want so you don't waste time building something they don't want.

Exchange 2016 on-premise application access

I have implemented an application which accesses calendars in an Office 356 E3 tenant. I've used the client_credentials flow and obtained Admin Consent. So far everything seems to work as expected.
Now I have a customer how wants to use my application with an Exchange 2016 on-premise setup. Is there a way to use the same application in this setup as well? Or do I have to implement a new application using EWS?
The graph API is not available on on-prem Exchange, so yes, you have to replace the graph API code with EWS code.
Depending on your use case, it is probably possible to abstract it such that your application can use either one or the other.
We had a similar issue.
You can change from Office365 Api to the MsGraph Api which supports many of the same features as the Office365 Api does. Your on premise customer needs to put his Exchange servers into hybrit mode for this. MS explained the necessary steps here.
The only problem we had is that you cant subscribe onto on premise calendars.
Here is the MsGraph Api doc
https://learn.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0
You can also consider switching from Office365 to MsGraph entirely as this should also work for you Office365 customers. As I understand it MS is gonna expand the MsGraph Api in the future giving us a single point of contact for interaction with the Office suite and authentication.
#Marc LaFleur pls correct me if I'm wrong on this

Is it possible to create google API KEY programmatically?

I'm trying to automate the process of creating and managing my projects on Google Cloud Platform. I want to create new project and generate API keys for it and use them.
I am unable to find any API to create API KEYS. Is there any solution ?
Thanks
You may not be able to create API keys programmatically, but you can create service accounts. Service accounts can do all the things on API keys can, and are much more secure than API keys. And you can create them via API calls!
Here's the API reference for creating service accounts, and for creating service account keys (which have a public/private keypair).
Here's the API reference for creating projects.
You should be able to do whatever you were trying to accomplish with these tools. But for most simple use-cases using the UI is recommended.
From My little experience you can't . You have to use Google API Console
❯ gcloud alpha services api-keys create --display-name=NAME
See: https://cloud.google.com/sdk/gcloud/reference/alpha/services/api-keys/create

Does Google Container Engine SDK/API exist?

I am planning to launch container cluster from an SDK/API. Presently, I am fine with any language, but I prefer NodeJS SDK. As far as I have seen, I could not find any Container engine SDK. Here is the NodeJS SDK for GCP which does not contain container engine. In fact it contains SDK only for very few GCP services.
I came across OAuth API for container engine but it involves human intervention to launch it. I am looking for service account based authentication for the SDK.
Are there container engine SDKs available ?
Update after discussion with Robert Lacok:
This is the code I tried to use for container APIs with API-key, it does not work. It expects Oauth 2 token, or some other credentials other than Service account. I tried API-key it didnt work. I dont know how to use Service account authentication with the API.
Here is my source code:
Here is the error:
I see a method for Application Default credentials. But I dont think so it will be useful for my use-case. I am trying to create container cluster from AWS Lambda. So, I cant use application default credentials. Is there any other options ?
The API for Google Container Engine is very limited at the moment as all the features are in Alpha status and because they can change not many people are incorporating them into the SDKs they are developing.
These are the current available APIs: https://cloud.google.com/sdk/gcloud/reference/container/
And here is the Alpha APIs: https://cloud.google.com/sdk/gcloud/reference/alpha/container/
What you probably want to do is making calls to the REST API and using the client library for OAuth2 authentication.
You can browse the API documentation and see that every method has a short how-to for a number of languages, NODE.JS being one of them. Have a look here for an example on how to create a container cluster.
You also mentioned service account authentication. The preferred way to do this is to use the application default credentials, you can have a little read about them here.
In short, you want to set an environment variable GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json which is a key to service account you generated in console.
Then the client library will take care of the rest (getting the OAuth tokens and what not).

Exchange ews api, list all users

I am trying to retrieve all users of an exchange server using EWS API, as this answer suggested, it's possible to do with powershell. However, I will need perform this task to many servers, running the script in each server is very time consuming, configuring remote EMC seemed not easy either.
So, I am thinking of implement this with C#, looping through each server and retrieve user list and save it in a database. But I couldn't find the EWS equivalent to "Get-Mailbox"
powershell command?
What should I do with this situation?
You can use PowerShell cmdlets with C# applications. There is a short example of using cmdlets with Exchange in the Exchange Management Shell SDK.

Resources