Microsoft graph API - unable to use $filter operation in "toRecipients" array - filter

Hello guys hope ur doing good,
I want to filter out the graph api response based on the "toRecipient" which is a array, hence I used lambda expression, but it gives error.
"error": {
"code": "ErrorInvalidUrlQueryFilter",
"message": "The query filter contains one or more invalid nodes.",
"innerError": {
"date": "2021-09-22T06:04:17",
"request-id": "c6077cd4-dbec-4671-9c11-10e547917d29",
"client-request-id": "66dfbc92-2482-11f3-86f9-22652a4e4e00"
}
}
My actual response is
"toRecipients": [
{
"emailAddress": {
"name": "abc",
"address": "abc#abc.com"
}
}
],
I had used this operation to filter out
https://graph.microsoft.com/v1.0/me/mailFolders/sentItems/messages?&$top=1000&$search="abc#abc.com"

Graph API calls underlaying Office 365 API.
According to the documentation, property ToRecipients is not filterable.

Related

Error to create a Databricks datasource using Power BI Rest API

I successfuly used the "Gateways - Create Datasource" (https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/create-datasource) method from Power BI Rest API to create a SQL datasource, but I´m stuck when I try to create a Databricks datasource.
I saw that there is no Databricks datasource kind, but it could be possible to use the kind "Extension". So a try this code:
OBS: I generated the credential part using the data gateway publick key and a Databricks key.
What am I missing, or doing wrong?
{
"datasourceName": "Databricks AIDA Teste",
"datasourceType":"Extension",
"connectionDetails":{
"path":"{\"host\":\"adb-xxx.azuredatabricks.net\",\"httpPath\":\"\\/sql\\/1.0\\/warehouses\\/xxx\"}",
"kind":"Databricks"
},
"credentialDetails": {
"credentialType": "Key",
"credentials": "xxx",
"privacyLevel": "Organizational"
}
}```
{
"error": {
"code": "BadRequest",
"message": "Bad Request",
"details": [
{
"message": "Unexpected character encountered while parsing value: {. Path 'connectionDetails', line 4, position 30.",
"target": "datasourceToGatewayRequest.connectionDetails"
},
{
"message": "'datasourceToGatewayRequest' is a required parameter",
"target": "datasourceToGatewayRequest"
}
]
}
}
Many thanks!

How do you subscribe to push notifications in microsoft graph?

I have been trying to figure out how to use the beta notifications resource to send push notifications to users in Teams, but I cannot get past step 1.
User signs in to your application, which creates a subscription with the Microsoft Graph notification service.
I am not using a language with Microsoft library support so I cannot use their SDKs. Instead, I am manually sending http requests. I have tried many, but I can't even nail down what the "resource" is supposed to be in the subscription type. Here are some of the things I have tried and the results:
Sending this message:
{
"changeType": "created",
"notificationUrl": "https://(...)/notifications",
"resource": "me/notifications",
"expirationDateTime": "2020-11-04T18:23:45.9356913Z"
}
Results in:
{
"error": {
"code": "InvalidRequest",
"message": "Subscription for resource 'me/notifications' is not supported.",
"innerError": {
"date": "2020-11-04T17:12:24",
"request-id": "66172d3c-298d-47d4-babb-52d96ef42179",
"client-request-id": "1c20849c-fcda-0b07-56e3-5bed08bb28e4"
}
}
}
The above message also correctly calls my server's /notifications route with this param:
Validation: Testing client application reachability for subscription Request-Id: 2f3cc3b8-b2c2-5922-451c-433add43bc74
Sending this one:
{
"changeType": "created",
"notificationUrl": "https://(...)/notifications",
"resource": "notification",
"expirationDateTime": "2020-11-04T18:23:45.9356913Z"
}
Results in:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'notification'.",
"innerError": {
"date": "2020-11-04T17:21:15",
"request-id": "d894c93b-9dac-4051-a3af-cb6039f1394b",
"client-request-id": "84d18ec7-2c67-8240-b576-03641b3b5a59"
}
}
}
I have also tried "notifications", "users/me/notifications", and a few others to no avail. What's the deal, Microsoft? This resource isn't even listed under the possible subscription types in the beta docs, so is it supported or not?
At this point I'm pretty sure this functionality just doesn't work/exist.

Problem with create team with Microsoft Graph Api

I have a problem with creating teams using the Microsoft Graph Api. I can get/create groups but when I try to get/create teams I get an error. I'm using postman and the group has owners and members, just as the documentation of MS, also has the permissitions it asks for groups. If somebody can help me, cause I look everywhere for a same error but no found it.
PUT https://graph.microsoft.com/v1.0/groups/{id}/team
Headers: Authorization: bearer token and content-type: json
Body is
{
"memberSettings": {
"allowCreateUpdateChannels": true
},
"messagingSettings": {
"allowUserEditMessages": true,
"allowUserDeleteMessages": true
},
"funSettings": {
"allowGiphy": true,
"giphyContentRating": "strict"
}
}
I always get the same error
{
"error": {
"code": "BadGateway",
"message": "Failed to execute backend request.",
"innerError": {
"request-id": "45eeba8a-9d35-45e8-b42e-c60da7a47dde",
"date": "2020-01-23T21:55:44"
}
}
}
According to the Graph API docs for this, you're not calling the correct endpoint to create a new Team. It should be
POST https://graph.microsoft.com/beta/teams
and a payload similar to
Content-Type: application/json
{
"template#odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('standard')",
"displayName": "My Sample Team",
"description": "My Sample Team’s Description",
"owners#odata.bind": [
"https://graph.microsoft.com/beta/users('userId')"
]
}
Note that it's slightly different, as per the docs, whether you're using delegated versus application permissons.

office 365 outlook Graph api custom email message header

In order to organize emails into single thread GMail requires custom headers to be set within incoming message. Is there any way to set custom headers when sending Office O365 Outlook message through the Graph API? The documentation states about custom headers option through the InternetMessageHeaders property, however it is required to start header name with 'x-' appendix, which makes it not usable. For example, this message is supposed to set some custom headers, however, due to the 'x-' prefix limitation, this can't be used for organizing GMail messages:
POST https://graph.microsoft.com/v1.0/me/sendMail
Content-type: application/json
{
"message": {
"subject": "9/9/2018: concert",
"body": {
"contentType": "HTML",
"content": "The group represents Nevada."
},
"toRecipients": [
{
"emailAddress": {
"address": "AlexW#contoso.OnMicrosoft.com"
}
}
],
"internetMessageHeaders":[
{
"name":"x-custom-header-group-name",
"value":"Nevada"
},
{
"name":"x-custom-header-group-id",
"value":"NV001"
}
]
}
}
https://learn.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http
Is there any way to specify custom headers: 'References', 'In-Reply-To' without the prefix 'x-'?
https://gsuiteupdates.googleblog.com/2019/03/threading-changes-in-gmail-conversation-view.html
When trying to set custom email headers without 'x-' prefix, the Graph API returns following error message:
{
"error": {
"code": "InvalidInternetMessageHeader",
"message": "The internet message header name 'References' should start with 'x-' or 'X-'.",
"innerError": {
"request-id": "441e21b7-d4ca-47d3-957a-a72bcc854a67",
"date": "2019-12-10T14:28:35"
}
}
}
One workaround might be to use the Extended properties to set those values eg the In-Reply-to https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtaginreplytoid-canonical-property should look something like
"singleValueExtendedProperties": [
{
"id":"String 0x1042",
"value":"342342343234#domain.com"
}
]

Non unique query with Freebase MQL read google api

It seems I am only able to do unique queries (i.e. including an entity id in the query) with the new freebase MQL read api:
The following searches on id and type:
https://www.googleapis.com/freebase/v1/mqlread?query={"name":null,"id":"/en/bob_dylan","type":"/people/person"}
and successfully returns:
{
"result": {
"type": "/people/person",
"id": "/en/bob_dylan",
"name": "Bob Dylan"
}
}
The following searches with type only:
https://www.googleapis.com/freebase/v1/mqlread?query={"name":null,"type":"/people/person"}
or
https://www.googleapis.com/freebase/v1/mqlread?query={"name":[],"type":"/people/person"}
and returns the following error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "Unique query may have at most one result. Got 100"
}
],
"code": 400,
"message": "Unique query may have at most one result. Got 100"
}
}
I expected it to return a list of people's names
You have to wrap your query in [ ], as in the following example:
https://www.googleapis.com/freebase/v1/mqlread?query=[{"name":[],"type":"/people/person"}]
I too faced a similar problem recently. The best way to make sure you get a single result set is to use "limit:1" parameter in your mql query.
for example:
https://www.googleapis.com/freebase/v1/mqlread?query={"type":[],"name":"india","limit":1}

Resources