Awhile ago I asked a related question. I've since then discovered that this query gets me very close to what I'm looking for:
https://graph.microsoft.com/v1.0/users?$expand=appRoleAssignments
with a return of
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(appRoleAssignments())",
"value": [{
"displayName": "Homer Simpson",
"jobTitle": "Nuclear Engineer",
"userPrincipalName": "homer#powerplant.com",
"id": "fdd865df-2715-4637-adb4-ee81e8f7fbdc",
"appRoleAssignments#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('fdd865df-2715-4637-adb4-ee81e8f7fbdc')/appRoleAssignments",
"appRoleAssignments": [{
"id": "ac-zitxw_Uiu2Lzm4rqdErfVvk5zpsVOnQlgbPkTgQo",
"appRoleId": "cde6f719-acc1-419b-a085-dff24137265b",
"principalDisplayName": "Homer Simpson",
"principalId": "fdd865df-2715-4637-adb4-ee81e8f7fbdc",
"principalType": "User",
"resourceDisplayName": "my-nuclear-explosion",
"resourceId": "d52ee6ae-70d7-4932-a89d-60d418828b41"
}]
}]
}
What I'm struggling with is trying to filter off the appRoleAssignments.resourceId, and am looking for help on how to achieve this.
Here are some of the following queries I've tried, and their errors:
https://graph.microsoft.com/v1.0/users?$expand=appRoleAssignments($filter=resourceId eq d52ee6ae-70d7-4932-a89d-60d418828b41)
{
"error": {
"code": "Request_BadRequest",
"message": "Invalid $select properties."
}
}
https://graph.microsoft.com/v1.0/users?&$expand=appRoleAssignments&$filter=appRoleAssignments/resourceId eq d52ee6ae-70d7-4932-a89d-60d418828b41
{
"error": {
"code": "BadRequest",
"message": "Invalid filter clause"
}
}
Any help would be appreciated!
If you want to filter by a guid then wrap the guid in single quotes.
https://graph.microsoft.com/v1.0/users?$expand=appRoleAssignments&$filter=appRoleAssignments/resourceId eq 'd52ee6ae-70d7-4932-a89d-60d418828b41'
Related
I am unable to search using microsoft graph api. The documentation is here.
Below is the sample provided in documentation, which itself is not working. Can someone suggest please. I actually want to search for people (and as per documentation /search is recommended way over /people. with /people query I am getting issue as faced in another thread)
URL : https://graph.microsoft.com/v1.0/users/<my mailbox name>/search/query
Request data:
{
"requests": [
{
"entityTypes": [
"message"
],
"query": {
"queryString": "contoso"
},
"from": 0,
"size": 25
}
]
}
Response:
{
"error": {
"code": "Request_BadRequest",
"message": "Unexpected segment DynamicPathSegment. Expected property/$value.",
"innerError": {
"date": "2023-01-18T16:19:05",
"request-id": "29a310fe-b5cf-4ea1-a995-3a09941d6d13",
"client-request-id": "29a310fe-b5cf-4ea1-a995-3a09941d6d13"
}
}
}
Send the POST request to https://graph.microsoft.com/beta/search/query endpoint.
POST https://graph.microsoft.com/beta/search/query
Request body
{
"requests": [
{
"entityTypes": [
"person"
],
"query": {
"queryString": "Sandeep"
},
"from": 0,
"size": 25
}
]
}
Searching for people requires delegated permissions.
Searching only works for searching the signed-in user's relevant people, not for searching people relevant to other users.
Limit of: 5 extension schema definitions can be written. !
Here is the response
{
"error": {
"code": "BadRequest",
"message": "Limit of: 5 extension schema definitions can be written.",
"innerError": {
"date": "2020-10-26T12:29:47",
"request-id": "requestID",
"client-request-id": "client-requestID"
}
}
}
And here is the request body
{
"id": "myMetaData",
"description": "My description",
"targetTypes": [
"Group"
],
"properties": [
{
"name": "shortName",
"type": "String"
},
{
"name": "supervisor",
"type": "String"
}
]
}
I have used delegated permision and used token generated by password since SchemaExtension needs delegated one and doesn't support application perm.
I got the answer , it was due to limit of the schemaExtensions that could be created other developer on the project already created 5 and since this was the limit set it showed this error
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"
}
}
I created a column with the name "col1" in the list through the web interface Office 365. When I tried to get whole info about this column using msgraph request to
GET /sites/{site-id}/lists/{list-id}/columns/{column-id}
I got such the response:
{
"#odata.context": ...,
"columnGroup": "Custom Columns",
"description": "",
"displayName": "col1",
"enforceUniqueValues": false,
"hidden": false,
"id": "a9fe9dc8-c5b8-467d-8504-23d95f1cc937",
"indexed": false,
"name": "_x0063_ol1",
"readOnly": false,
"required": false,
"number": {
"decimalPlaces": "automatic",
"displayAs": "number",
"maximum": 1.7976931348623157e+308,
"minimum": -1.7976931348623157e+308
}
}
So the problem is that I cannot create an item with that column (I tried both names "col1" and "_x0063_ol1"). The request was to
POST /sites/{site-id}/lists/{list-id}/items
with the body:
{
"fields": {
"Title": "Test2",
"_x0063_ol1": 42
}
}
I got response:
{
"error": {
"code": "invalidRequest",
"message": "Field '_x0063_ol1' is not recognied",
"innerError": {
"request-id": "dbb98ed3-0c2f-48dc-924e-dd888e70c867",
"date": "2018-05-02T07:41:36"
}
}
}
How can I properly create the item with this column using msgraph API?
i am working on to display wall posts (Stream) data using Google Plus API.
i have valid Client ID + API_KEY.
I am able to get response from Google Plus cloud console.i.e. by executing method I get Something like
Request
GET https://www.googleapis.com/plus/v1/people/myuserid/activities/public?maxResults=5&key={YOUR_API_KEY}
X-JavaScript-User-Agent: Google APIs Explorer
Response
200 OK
Show headers -
{
"kind": "plus#activityFeed",
"etag": "\"Mwea3qudNDf-hWWlPWi3n-YrU1Q/ovxXa0lmTRbwzkDa9o_iJ2pdFBs\"",
"nextPageToken": "CAIQgIi2z8bDugIgASgB",
"title": "Google+ List of Activities for Collection PUBLIC",
"updated": "2013-11-01T12:07:44.665Z",
"items": [
{
"kind": "plus#activity",
"etag": "\"Mwea3qudNDf-hWWlPWi3n-YrU1Q/JdSanh1QlMQ72Ubbabsiz2rP4B8\"",
"published": "2013-11-01T12:07:44.665Z",
"updated": "2013-11-01T12:07:44.665Z",
"id": "id",
"url": "https://plus.google.com/userid/posts/bYSPSVjXCXL",
"actor": {
"id": "116100754354787768146",
"displayName": "name",
"url": "https://plus.google.com/userid",
"image": {
"url": "someurl"
}
},
"verb": "post",
"object": {
"objectType": "note",
"content": "",
"url": "https://plus.google.com/userid/posts/bYSPSVjXCXL",
"replies": {
"totalItems": 1,
"selfLink": "https://content.googleapis.com/plus/v1/activities/z13xulwx3qjuxnkii04cjpsqgsjlyp2j23o/comments"
},
}
........
Seems good till now..but,when i use Request URL i.e https://www.googleapis.com/plus/v1/people/myuserid/activities/public?maxResults=5&key={MY_API_KEY} i got something from browser like this
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured"
}
],
"code": 403,
"message": "Access Not Configured"
}
}
where i am going wrong ?! how to get correct response from Browser. ? as i want to parse them and use these data in my Application.
NOTE: Google + API is ON.
Are you making sure that you have replaced {MY_API_KEY} with the API key that you have generated using the Cloud Console?
Are you using the Browser Key? It works OK for me.