Not getting any webhook notification for Microsoft O365 Management APIs - office365api

I have created the below webhooks and all are enabled.:
[
{
"contentType": "Audit.AzureActiveDirectory",
"status": "enabled",
"webhook": {
"authId": "12345",
"address": "https://978b7cfb66d9.ngrok.io/callback/",
"expiration": "",
"status": "enabled"
}
},
{
"contentType": "Audit.General",
"status": "enabled",
"webhook": {
"authId": "12345",
"address": "https://978b7cfb66d9.ngrok.io/callback/",
"expiration": "",
"status": "enabled"
}
},
{
"contentType": "Audit.SharePoint",
"status": "enabled",
"webhook": {
"authId": "12345",
"address": "https://978b7cfb66d9.ngrok.io/callback/",
"expiration": "",
"status": "enabled"
}
}
]
I don't see any notifications coming when there are changes made in sharepoint. Anything in particular need to change?
From the access token, I do see correct app permissions:
"roles": [
"ServiceHealth.Read",
"ActivityFeed.Read"
]
I manually queried to get content and it shows empty.
https://manage.office.com/api/v1.0/{tenant-guid}/activity/feed/subscriptions/content?contentType=Audit.Sharepoint

Looks like the auditing for Office 365 organization is disabled.
Make sure you turn on audit log search.

Related

Configuring activity types in a Microsoft teams app

I have sideloaded a teams app with an activity type, so that I could I could use the activity feed graph api. However, when I send a teams/<teamId>/sendActivityNotification request, I get 501 "Not Implemented". There are no specifics in the response.
{ "error": { "code": "NotImplemented", "message": "Failed to process request.", "innerError": { "date": "2021-04-16T07:48:31", "request-id": "bd92c3a5-9ec5-49a1-a2d5-057f7dd3c182", "client-request-id": "bd92c3a5-9ec5-49a1-a2d5-057f7dd3c182" } }}
I think I may be missing something about how graph API integrates with teams apps.
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.8/MicrosoftTeams.schema.json",
"manifestVersion": "1.8",
"id": "<APP_ID>",
"version": "1.0",
"packageName": "com.nikita",
"developer": {
"name": "Nikita Cool Dude",
"websiteUrl": "https://www.microsoft.com",
"privacyUrl": "https://www.microsoft.com",
"termsOfUseUrl": "https://www.microsoft.com"
},
"name": {
"full": "MMM service test",
"short": "MMM service test"
},
"accentColor": "#FFFFFF",
"description": {
"full": "Packages mmm activity types.",
"short": "Packages mmm activity types."
},
"icons": {
"outline": "mmm-small.png",
"color": "mmm-small.png"
},
"activities": {
"activityTypes": [
{
"type": "mmmChannelCreated",
"description": "New channel is created for an mmm event",
"templateText": "New <priority> <cfs> event"
}
]
},
"connectors": [
{
"connectorId": "<APP_ID>",
"scopes": ["team"]
}
]
}
Note that I am adding a connector I'm not using. Otherwise I get Error while reading manifest.json: "configurableTabs, staticTabs, bots, connectors, or composeExtensions" is required error when sideloading the app. The app id is created through portal.azure.com.
Below is the request payload, in case that is relevant. I based it very closely on examples in the graph API documentation.
{
"topic": {
"source": "entityUrl",
"value": "https://graph.microsoft.com/v1.0/teams/<teamId>/channels/<channelId>",
},
"activityType": "mmmChannelCreated",
"previewText": {
"content": "New important event!"
},
"templateParameters": [
{
"name": "priority",
"value": "P1"
},
{
"name": "cfs",
"value": "Armed Robbery"
}
]
}
Any ideas are appreciated!
In your manifest webApplicationInfo section is missing. The Teams app manifest must have the Azure AD app ID added to the webApplicationInfo section. Follow the requirements provided in documetation to use sendActivityNotification.

Unable to retrieve event details using Microsoft Graph API 1.0

Has anyone got Microsoft Graph API working for EventMessage? i.e reading email content of EventMessage using Graph API.
Looks like it has actionable card and graph API 1.0 is not able to read it.
Provided delegate access to user for a room resource.
On event creation for that room, mail is received by the delegated user in inbox. The mail type is eventMessage ("#odata.type": "#microsoft.graph.eventMessage").
On fetching the mail through GraphAPI v1.0, the event values are not visible in the response.
Also on setting the Expand property for the mail in graph API as per docs, results in below error.
{ "error": {
"code": "BadRequest",
"message": "Parsing Select and Expand failed.",
"innerError": {
"request-id": "310bbcce-bdd8-4cb6-890c-035243a5ab6d",
"date": "2020-01-21T09:18:10"
}
}
}
I'm unable to repro your issue. The Microsoft Graph API returns details for event messages. Can you provide repro steps, request/response capture, and the values that you'd expect to see?
I used v1.0/me/messagesto get all of the messages to find an eventMessage. I then perform the following to get details on the eventMessage:
GET https://graph.microsoft.com/v1.0/me/messages/{messagedId}
Response body:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('d09-94-498-a9777d4b')/messages/$entity",
"#odata.type": "#microsoft.graph.eventMessage",
"#odata.etag": "W/\"DAA2pU9s\"",
"id": "AAMkADEzOTExYjJkAAA=",
"createdDateTime": "2020-01-24T14:47:24Z",
"lastModifiedDateTime": "2020-01-24T21:08:07Z",
"changeKey": "DApU9s",
"categories": [],
"receivedDateTime": "2020-01-24T14:47:25Z",
"sentDateTime": "2020-01-24T14:47:11Z",
"hasAttachments": false,
"internetMessageId": "<AM5P3M#A38.EURPRD83.prod.outlook.com>",
"subject": "Accepted: Microsoft Graph DevX Roadmap",
"bodyPreview": "",
"importance": "normal",
"parentFolderId": "AAMk3AAA=",
"conversationId": "AAQkADEzOU4=",
"conversationIndex": "AdXReVPepTg==",
"isDeliveryReceiptRequested": null,
"isReadReceiptRequested": false,
"isRead": true,
"isDraft": false,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"meetingMessageType": "meetingAccepted",
"body": {
"contentType": "text",
"content": ""
},
"sender": {
"emailAddress": {
"name": "Nicole",
"address": "sig#contoso.com"
}
},
"from": {
"emailAddress": {
"name": "Nicole",
"address": "sig#contoso.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Michael Mainer",
"address": "mm#contoso.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"flag": {
"flagStatus": "notFlagged"
}
}

Pull Request Statuses - Added custom properties to a status aren't getting persisted by TFS

We are operating a TFS 2018 Update 2 in our enviroment.
We are sending the example json found here to our server and it is getting accepted successfully:
{
"properties": {
"sampleId": 7,
"customInfo": "Custom status information",
"startedDateTime": {
"$type": "System.DateTime",
"$value": "2017-09-19T14:50:26.7410146Z"
},
"weight": {
"$type": "System.Double",
"$value": 1.75
},
"bytes": {
"$type": "System.Byte[]",
"$value": "dGhpcyBpcyBzYW1wbGUgYmFzZTY0IGVuY29kZWQgc3RyaW5n"
},
"globalId": {
"$type": "System.Guid",
"$value": "1e788cb9-9d3d-4dc6-ac05-822092d17f90"
}
},
"state": "succeeded",
"description": "Sample status succeeded",
"context": {
"name": "sample-status-1",
"genre": "vsts-samples"
},
"targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1"
}
But the response doesn't look like in the documentation. Instead it looks like this:
{
"id": 6,
"state": "succeeded",
"description": "Sample status succeeded",
"context": {
"name": "sample-status-1",
"genre": "vsts-samples"
},
"creationDate": "2019-12-11T16:14:05.0574648Z",
"updatedDate": "2019-12-11T16:14:05.0574648Z",
"createdBy": {
"displayName": "...",
"url": "https://.../_apis/Identities/0b85e078-130d-4cb8-a450-17c5c7efccec",
"_links": {
"avatar": {
"href": "https://.../_api/_common/identityImage?id=0b85e078-130d-4cb8-a450-17c5c7efccec"
}
},
"id": "0b85e078-130d-4cb8-a450-17c5c7efccec",
"uniqueName": "...",
"imageUrl": "https://.../_api/_common/identityImage?id=0b85e078-130d-4cb8-a450-17c5c7efccec"
},
"targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1",
"_links": {
"self": {
"href": "https://.../_apis/git/repositories/35fe73eb-7af1-4bba-bf04-545611fcac1d/pullRequests/58/statuses/6"
},
"repository": {
"href": "https://.../_apis/git/repositories/35fe73eb-7af1-4bba-bf04-545611fcac1d"
}
}
}
The properties are gone. What could be wrong?
Could it be a somehow completely missleading documentation?
To troubleshoot your issue, please check the following items:
Check whether the Status updated on the pull request after running the POST request.
Press F12 in your browser, and send the POST request to check the statuses to see whether you can get properties in the response body.
Check your TFS edition by going to Administration Console -- Application Tier, or checking the About on the web portal. The issue can not be reproduced in TFS 2018.2 on our side.

Create a JIRA ticket via service desk api

I am trying to create a ticket in JIRA by following https://docs.atlassian.com/jira-servicedesk/REST/3.6.2/#servicedeskapi/request-createCustomerRequest
I send a post request to https:/x.atlassian.net//rest/servicedeskapi/servicedesk/request
With following json param
{
"serviceDeskId": “1”,
"requestTypeId": “1”,
"requestFieldValues": {
"summary": "Request raised via service REST API",
"description": "test."
}
}
But it replied with 404 error
{
"errorMessage": "Invalid project key 'request'",
"i18nErrorMessage": {
"i18nKey": "sd.error.project.by.key.not.found",
"parameters": [
"request"
]
}
}
Update - the service desk id and request type id got from a response of rest/servicedeskapi/request/{issueid}. Therefore values used for service desk id request type id can not be wrong
I tried servicedesk/1/requesttype/1/field and I received
{
"requestTypeFields": [
{
"fieldId": "summary",
"name": "Subject",
"description": "",
"required": true,
"defaultValues": [],
"validValues": [],
"jiraSchema": {
"type": "string",
"system": "summary"
}
},
{
"fieldId": "description",
"name": "Body",
"description": "",
"required": false,
"defaultValues": [],
"validValues": [],
"jiraSchema": {
"type": "string",
"system": "description"
}
}
],
"canRaiseOnBehalfOf": true,
"canAddRequestParticipants": true
}
I am not able to understand what am I missing. Can someone please advice
Issue was with the url. There is an unnecessary 'servicedesk' in the url.
After removing that it worked.
https:/x.atlassian.net//rest/servicedeskapi/request

Create thread in Microsoft Teams with Subject

I'm currently trying to create a Microsoft teams thread (within a channel) via the Microsoft Graph API.
I'd like thread to have a subject/title and I'm sending the following request (from the graph explorer)
POST https://graph.microsoft.com/beta/teams/{teamId}/channels/{channelId}/chatThreads
with the following payload
{
"rootMessage": {
"body": {
"contentType": 1,
"content": "<h1>Hello world</h1>"
},
"subject": "Welcome Aboard!"
}
}
However the thread that gets created doesn't have any title as you can see on the following screen capture.
So the question is: how can I create a chat thread with a subject from the Microsoft Graph API?
Edit: here is the payload I get for the message "title from teams" (which was created from the UI), note is contains a subject attribute.
{
"replyToId": null,
"etag": "1537198542791",
"messageType": "message",
"createdDateTime": "2018-09-17T15:35:42.791Z",
"lastModifiedDateTime": null,
"deleted": false,
"subject": "title from teams",
"summary": null,
"importance": "normal",
"locale": "en-us",
"id": "1537198542791",
"from": {
"application": null,
"device": null,
"user": {
"id": "c2e8df37-c6a7-4d88-89b1-feb4f1fda7c5",
"displayName": "Vincent Biret",
"identityProvider": "Aad"
}
},
"body": {
"contentType": "text",
"content": "wvwvwevw"
},
"attachments": [],
"mentions": [],
"reactions": []
}
There is no "subject" for a post in Microsoft Teams. These are chat threads, not email threads. The only content is the body:
{
"rootMessage": {
"body": {
"contentType": 1,
"content": "<h1>Hello world</h1>"
}
}
}

Resources