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.
Related
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
The new way to upload images as hosted content through the Send Message endpoint is great! However, is there a way to upload text/plain as hosted content in order to post a Code Snippet Card in a message?
I have tried uploading text but the response gives me an error that says that the only content types allowed are 'image/jpg,image/jpeg,image/png'.
Example request:
{
"body": {
"contentType": "html",
"content": "<attachment id=\"4d92eb51ab9c48ebb5b364794a2fa569\"></attachment>"
},
"attachments": [
{
"id": "4d92eb51ab9c48ebb5b364794a2fa569",
"contentType": "application/vnd.microsoft.card.codesnippet",
"contentUrl": null,
"content": "{\"name\":\"\",\"language\":\"CSharp\",\"lines\":1,\"wrap\":false,\"codeSnippetUrl\":\"../hostedContents/1/$value\"}",
"name": null,
"thumbnailUrl": null
}
],
"hostedContents":[
{
"#microsoft.graph.temporaryId": "1",
"contentBytes": "VGVzdA==",
"contentType": "text/plain"
}
]
}
Response:
{
"error": {
"code": "BadRequest",
"message": "Unsupported content type in hostedContent with Id '1'. Allowed values are 'image/jpg,image/jpeg,image/png'",
"innerError": {
"date": "2020-10-07T12:17:15",
"request-id": "ed24f5df-3e1f-4871-b430-e4c1c9f30348",
"client-request-id": "ed24f5df-3e1f-4871-b430-e4c1c9f30348"
}
}
}
I received an answer in the Documentation GitHub: https://github.com/microsoftgraph/microsoft-graph-docs/issues/10210#issuecomment-705050649
Code snippets are not supported at the moment. They are on list of things to support, but there is no timeline to share yet.
I have been trying to grant a single user (possibly outside of the organization) access to a folder used by a shared group in Share Point The Microsoft Graph Docs state that the response should have an Id in it.
If I use a personal oneDrive account, and make the following request:
POST v1.0
https://graph.microsoft.com/v1.0/groups/{groupId}/drive/items/{folderId}/invite
body: {
"requireSignIn": true,
"sendInvitation": true,
"roles": [ "read"],
"recipients": [
{ "email": "{myPersonalEmail}" },
],
"message": "testing giving permission to self"
}
I get the following response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(permission)",
"value": [
{
"#odata.type": "#microsoft.graph.permission",
"id": "{permissionID}",
"roles": [
"read"
],
"grantedTo": {
"user": {
"email": "{myPersonalEmail}",
"id": "{responseID}",
"displayName": "Sarah"
}
}
}
]
}
However, we setup a different SharePoint account that when I make the same request https://graph.microsoft.com/v1.0/groups/{groupId}/drive/items/{folderId}/invite
I get a completely different response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(permission)",
"value": [
{
"#odata.type": "#microsoft.graph.permission",
"roles": [
"read"
],
"invitation": {
"signInRequired": true
},
"link": {
"type": "view",
"webUrl": "{shareURL}"
}
}
]
}
This is so bizarre to me, because we are hitting the same endpoint. It makes me think that maybe there are some site configurations that are making these two responses differ.
Does anyone know why we would be getting a different results from the same endpoint?
I am using postman APP for accessing GET request through TWITTER API. Though I am able to generate output through all other GET and POST request through OAUTH 1.0. But when I am sending the request through "GET /1/stats/accounts/:account_id" method, its generating the following error.
{
"errors": [
{
"code": "UNAUTHORIZED_ACCESS",
"message": "This request is not properly authenticated"
}
],
"request": {
"params": {}
}
}
I am using the following request : "https://ads-api.twitter.com/1/stats/accounts/:18ce53yh9sw?entity_ids=88hjg&entity=CAMPAIGN&end_time=2017-05-14T17:00:00Z&granularity=HOUR&metric_groups=BILLING&placement=ALL_ON_TWITTER&start_time=2017-05-05T15:00:00Z"
This is the most important GET request for me to get the campaign level data. Any other way around may be helpful.
UPDATE:
The following request is working for https://ads-api.twitter.com/1/accounts/:account_id
{
"request": {
"params": {}
},
"data": [
{
"name": "Wadi.com",
"business_name": null,
"timezone": "Asia/Riyadh",
"timezone_switch_at": "2013-05-21T21:00:00Z",
"id": "18ce53yh9sw",
"created_at": "2015-03-12T07:33:09Z",
"salt": "0f034423fa35f95e8efc844a25c4d7a3",
"updated_at": "2017-05-17T06:03:58Z",
"business_id": null,
"approval_status": "ACCEPTED",
"deleted": false
}
],
"data_type": "account",
"total_count": 1,
"next_cursor": null
}
Regards
Shree Kant
It looks like the OData $count parameter is not (yet?) supported in the Microsoft Graph API v1.0 for OneDrive.
Request URL: https://graph.microsoft.com/v1.0/me/drive/root/children?$count=true
Response:
{
"error": {
"code": "",
"message": "The query specified in the URI is not valid. Query option 'Count' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.",
"innerError": {
"request-id": "e65aff74-1c6f-434b-8cd3-04e0c247fb71",
"date": "2016-10-19T09:48:39"
}
}
}
Is this understanding correct?
The $count parameter isn't supported with OneDrive. You can get a count of the children however by moving one level up:
/v1.0/me/drive/root/
This includes a folder property that contains the number of child items:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('id')/drive/root/$entity",
"createdDateTime": "2012-08-03T08:12:58Z",
"id": "{id}",
"lastModifiedDateTime": "2016-10-18T14:19:21Z",
"name": "root",
"webUrl": "{webUrl}",
"folder": {
"childCount": 28
},
"root": {},
"size": 0,
"specialFolder": {
"name": "documents"
}
}