Reading emails from Exchange online in c#.net using Office 365 API - office365api

I am trying to read emails from Exchange online through a Office 365 API.with using my username and password for authentication.
Is it possible to access the O365 api? (only using user credentials)
How can I do that? Anyone can help is appreciated.

If your exchange online is part of Office 365, you should definitively take a look here : http://dev.office.com
You will find many tutorials to get access to your mails.
Take a look here : http://dev.office.com/getting-started/office365apis
It uses the Microsoft Graph to query your mailbox and retrives messages :
https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages
The authentication process is provided byt Azure Active Directory, through ADAL SDK.
In Visual Studio, you can create easily an application, and then call the submenu 'Add connected services' and you're done !

Related

Is it possible to set an email signature in Office 365 Outlook to a user via API?

I am developing an application in ASP .Net MVC. I have Azure Active Directory authorization in it. Is it possible to set an email signature in Office 365 Outlook for domain users via API? My googling skills did not allow me to find any information about this. Before that, I used Google Workspace and it was possible. Now I'm in a situation where I have to transfer some things from Google API to Office 365, and I can't see anything about the footer.

Excel web addin authentication for AppSource

I am building an Excel Web Addin. I'll need to authenticate the user against Office 365 and publish the addin to AppSource / Office Store. What is the ideal authentication method to use?
I found tutorials for SSO authentication, but then I read on https://learn.microsoft.com/en-us/office/dev/add-ins/develop/sso-in-office-add-ins : "The Single Sign-on API is currently supported in preview only. It is available to developers for experimentation; but it should not be used in a production add-in. In addition, add-ins that use SSO are not accepted in AppSource."
Does this mean SSO applications will still not be accepted to the Store? What authentication flow should I use then? I only need the user to sign in a access my Web API via this identity. If possible, the user shouldn't need to reenter their credentials. Is there a code sample I could follow to get this done?
AppSource is not accepting add-ins that use the preview SSO system at this time.
To authenticate a user with a Microsoft Account or a Work or School (Office 365) account without SSO, the user will need to sign in again even if she or he is already logged into Office. Without the SSO system, the add-in has no way of knowing who is logged into Office, just as an web app open in a browser wouldn't know if Office is running on the machine or who is logged into it.
(Your choice of flow might be affected by whether you have a single page app (SPA) or a server-generated UI. Since you mentioned you have a Web API, I'll assume this is not a SPA.)
I don't know of any sample Office Add-ins that only authenticate the user; but there are a couple that log in the user and then use the Auth Code Flow to get an access token to Microsoft Graph.
PowerPoint Add-in Microsoft Graph ASPNET InsertChart. The Office app is PowerPoint, but the auth-related code would be the same for Excel.
Office Add-in Microsoft Graph ASPNET. This is nearly the same, but has Excel as the Office app. It's not polished. (See the Known Issues in the readme.)
But please keep in mind that an Office add-in is just a web app and -- with one exception -- authorizing a user is the same in an add-in as it would be in any other web app. So, you should be able to use the samples in Azure AD Quickstarts.
The one exception is that you have to open the AAD sign-in page in a special dialog window that is invoked with the Office.js displayDialogAsync API. The 2 samples I linked to above do this. You can get detailed guidance about using the Dialog for auth in the article Dialog API in Office Add-ins.
BTW, Microsoft is in the process of improving its documentation and samples for non-SSO auth. We hope to get these improvements published over the next few weeks.

SharePointOnline: How to authenticate user from Azure AD via CSOM

I have the following requirements:
Create a MVC site with Azure AD authentication.
Fetch lists from SharePointOnline/O365 which also uses the same Azure AD.
Fetch lists from SharePointOnline/O365 anonymously (is it even possible?)
Thanks to VS2015 the first step is trivial.
But how to authenticate the current user in SharePoint? User.Identity does not provide password, so I cannot use ClientContext.Credentials.
I heard there is some Token Provider but haven't found a working case yet. Can anyone help me out?
To get the list of SharePoint online from our MVC sites, you can consider using the Microsoft Graph REST API instead of CSOM.
You can refer here about the list operation of Microsoft Graph. However, since this API is in beta version, it is not recommend to use in the product version.
And you also can refer the link below to get started developing with Microsoft Graph:
App authentication with Microsoft Graph

Office 365 Outlook Calendar : How to access multiple user's calendar in a single ASP.NET MVC application?

We are trying to implement a calendar portal (C# ASP.NET MVC) where one admin can see multiple outlook(or office 365) users calendar and see who is available. So multiple accounts should be accessed from one ASP.NET MVC application.
First question : Is it even possible? (may be because I had already seen post on stackoverflow : EWS - Access All Shared Calendars )
Second question : What would be the right approach?
Third question : Is there any project available from Microsoft or article? (I could find any good one)
I have had gone through Using Azure Multi-Tenant application without an Office 365 subscription to access users calendar information and https://www.youtube.com/watch?v=0kvDyl5HShA.
I have had also get connected with a single user's account via OAuth2. It was successful.
Currently, we have this subscription. If any more information required then please comment. Then I will add more description as per necessary.
Thank you.
You could try to build Daemon or Service Apps using client credential grant flow as described in this blog, the service app that requires admin consent, but is authorized to access any user's mailbox/calendar information in your Office 365 tenant. You could click here for sample web app that uses client credential flow to access Users, Mail, Calendar, Contacts in Office 365 via Rest APIs .
This link you provided needs to associate your Office 365 account with Azure AD to create and manage apps .If you can have an existing Microsoft Azure subscription, you can associate your Office 365 for business subscription with it. .Otherwise, you'll need to create a new Azure subscription and associate it with your Office 365 account in order to register and manage apps. For more details ,please read how to set up your Office 365 development environment.

Using Office-365-SDK-for-iOS

I am integrating Office-365-SDK-for-iOS to fetch the user profile and contacts from outlook 365. I configure my application on azure management portal successfully. below are the constants for the app-
#define OutlookClientId #"11d21f9f-6b16-4ea9-8f73-bbc9a65ac72b"
#define OutlookAuthority #"https://login.microsoftonline.com/06cbda59-d75b-4547-8406-e6af3ff4c658/oauth2/token?api-version=1.0"
#define OutlookRedirectUrl #"http://localhost/MyAppName"
#define OutlookRsourceId #"https://graph.microsoft.com/"
When I am giving resourceId is https://outlook.office365.com/.
Then its giving me an error that this is not a valid resource id configured for the app.
I read many url to fined out the problem but I failed.These urls says that "If your app requires permissions to the Office 365 Mail, Calendar, or Contacts APIs, select the Office 365 Exchange Online service." but there is no this service to enable. Below is my add application page screen shot-
There are only 3 application to add.
Please help me out out on this.
Thanks
What type of account are you logging onto the Azure management portal with? Does it have access to Exchange Online? My guess is your Office 365 subscription doesn't include Exchange or SharePoint, so you don't see them there.
It looks like you're trying to use the Unified API though. In that case your resource ID should be https://graph.microsoft.com/.
Ravi,
Please take a look at this article:
https://msdn.microsoft.com/en-us/office/office365/howto/get-started-with-office-365-unified-api
The resource for the unified API is https://graph.microsoft.com not the one that you mention above.
In addition, if you want to query mail, events, files, etc, the tenant you are using for development must have a valid Office365 subscription.
Finally, personal contacts (aka. contacts in Outlook) are not yet supported (coming soon), right now you can access organizational contacts using this request: graph.microsoft.com/beta/myOrganization/contacts

Resources