Sandy
Sandy

Reputation: 6353

Office 365 activity logs API

Is there any API available for Office 365 API through which i can fetch or monitor logs by using application (console/library)? I want to monitor login, logout, email received, forwarded etc all the activities happening on Office365 account.

Same question asked here for around one year before. Currently is there any solution for the same?

I need to pass access_token in Office 365 Management APIs. How to get that token in Windows Console/Library project.

Upvotes: 3

Views: 1969

Answers (2)

Sandy
Sandy

Reputation: 6353

I got the answer here

**

Office 365 Management APIs

** Prerequisites: Subscription to Office 365 and a subscription to Azure that has been associated with your Office 365 subscription. For more details, see Associate your Office 365 account with Azure AD to create and manage apps.

Overview: • The client application authenticates to the Azure AD token issuance endpoint and requests an access token. • The Azure AD token issuance endpoint issues the access token. • The access token is used to authenticate to the secured resource. • Data from the secured resource is returned to the application.

There are four key steps: 1. Registration in Azure AD Register both the calling service and the receiving service in Azure Active Directory (Azure AD). For detailed instructions, see MSDN link.

  1. Requesting access tokens from Azure AD To request an access token, use an HTTP POST to the tenant-specific Azure AD endpoint. https://login.microsoftonline.com//oauth2/token

Request example:

POST contoso.com/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=625bc9f6-3bf6-4b6d-94ba-e97cf07a22de&client_secret=qkDwDJlDfig2IpeuUZYKH1Wb8q1V0ju6sILxQQqhJ+s=&resource=https%3A%2F%2Fservice.contoso.com%2F

Response example:

{
"access_token":"eyJhbGciOiJSUzI1NiIsIng1dCI6IjdkRC1nZWNOZ1gxWmY3R0xrT3ZwT0IyZGNWQSIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL3NlcnZpY2UuY29udG9zby5jb20vIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvN2ZlODE0NDctZGE1Ny00Mzg1LWJlY2ItNmRlNTdmMjE0NzdlLyIsImlhdCI6MTM4ODQ0ODI2NywibmJmIjoxMzg4NDQ4MjY3LCJleHAiOjEzODg0NTIxNjcsInZlciI6IjEuMCIsInRpZCI6IjdmZTgxNDQ3LWRhNTctNDM4NS1iZ",
"token_type":"Bearer",
"expires_in":"3599",
"expires_on":"1388452167",
"resource":"https://service.contoso.com/"
}
  1. Call the Office 365 Management APIs. The app-only access tokens are passed to the Office 365 Management APIs to authenticate and authorize your application.

Upvotes: 2

Rams
Rams

Reputation: 2189

ews-java-api having a feature of pull notifications, check their documentation. It may help you but I'm not sure.

This api doesn't have a stable release, snapshots releases are there.

And check this one also https://msdn.microsoft.com/office/office365/APi/notify-rest-operations

Thanks

Upvotes: 3

Related Questions