How we can call microsoft Search API with POST in React App - microsoft-graph-api

I want to call MS Graph Search API in react app, I registered the app with sites.read.all with delegated permissions.
The filter should be from SharePoint list data.
code
https://graph.microsoft.com/v2.0/search/query
{
"requests": [
{
"entityTypes": [
"listItem"
],
"query": {
"queryString": "contoso"
}
}
]
}

AFIAK there is no code or searching option for using Search API in MS graph, you can refer to this similar question:API based search using React
Or raise a feature request for the same in here: https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform
Hope this helps.

Related

Microsoft Graph API - Search email using application permission

I want to search email using Graph API in my own developed application. By referring to these threads - Graph Api: Region is required when request with application permission , How to use Graph API Sharepoint Search from console app , Search content with application permissions , I tried to run the search which resulted in Application permission is only supported for the following entity types:site, list, listItem, drive and driveItem. (Request and response json is below).
Does it mean that using an app like a console application developed in C# will not be able to search the emails (as message is not mentioned in error response - only these are mentioned: site, list, listItem, drive and driveItem) even if it has required secret, auth token and permissions?
Request:
URL : https://graph.microsoft.com/beta/search/query
Request Payload:
{
"requests": [
{
"entityTypes": [
"person"
],
"query": {
"queryString": "contoso"
},
"Region" : "NAM",
"from": 0,
"size": 25
}
]
}
Response:
{
"error": {
"code": "System.UnauthorizedAccessException",
"message": "Application permission is only supported for the following entity types:site, list, listItem, drive and driveItem.",
"target": "",
"httpCode": 403
},
"Instrumentation": {
"TraceId": "7174e417-a2fe-02e5-1523-1fcda7a66886"
}
}

Assign a group to a Intune Endpoint security policy

I'd like to find a way using PowerShell to assign a group to a Intune endpoint security policy like disk encryption or a security baseline for Windows 10 (not iOS or Android). I managed to create policies using PS but can't find how to assign a group.
I used the Graph API to create the policy using https://graph.microsoft.com/beta/deviceManagement/templates/$TemplateId/createInstance.
Any help would be appreciated.
Cheers
The endpoint for a security baseline assignment would look like this:
POST https://graph.microsoft.com/beta/deviceManagement/intents/$IDOFYOURNEWSECURITYBASELINE/assign
Example body for one include and one exclude group:
{
"assignments": [
{
"target": {
"#odata.type": "#microsoft.graph.groupAssignmentTarget",
"groupId": "$IDOFYOURAADGROUPTOASSIGN1"
}
},
{
"target": {
"#odata.type": "#microsoft.graph.exclusionGroupAssignmentTarget",
"groupId": "$IDOFYOURAADGROUPTOASSIGN2"
}
}
]
}

Microsoft Graph translateExchangeIds not returning the same id as EWS

I am working with both EWS and the Graph API.
I would like to create events (online meetings with skype/teams) in an calendar that is already available via EWS.
To match the calendar to the one available via Graph API i try to use https://learn.microsoft.com/en-us/graph/api/user-translateexchangeids
The calendar i created has this id when returned by the FindFolder call:
<t:FolderId Id="AAMkAGNiY2YxMjY3LTUxYjgtNGI1Yy1hOTM2LTU4MTM5OTZiNjdjYgAuAAAAAABW2gY0kRG1SqggDTNZN6i8AQAPJkKZ1XJkQ6huFmcVa6XaAAGixNZ3AAA=" ChangeKey="..."/>
<t:DisplayName>Test</t:DisplayName>
I create a request to the graph api:
{
"inputIds": [
"AAMkAGNiY2YxMjY3LTUxYjgtNGI1Yy1hOTM2LTU4MTM5OTZiNjdjYgAuAAAAAABW2gY0kRG1SqggDTNZN6i8AQAPJkKZ1XJkQ6huFmcVa6XaAAGixNZ3AAA="
],
"sourceIdType": "ewsId",
"targetIdType": "restId"}
and get the result
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.convertIdResult)",
"value": [
{
"sourceId": "AAMkAGNiY2YxMjY3LTUxYjgtNGI1Yy1hOTM2LTU4MTM5OTZiNjdjYgAuAAAAAABW2gY0kRG1SqggDTNZN6i8AQAPJkKZ1XJkQ6huFmcVa6XaAAGixNZ3AAA=",
"targetId": "AAMkAGNiY2YxMjY3LTUxYjgtNGI1Yy1hOTM2LTU4MTM5OTZiNjdjYgAuAAAAAABW2gY0kRG1SqggDTNZN6i8AQAPJkKZ1XJkQ6huFmcVa6XaAAGixNZ3AAA="
}
]
}
However, if i call https://graph.microsoft.com/v1.0/me/calendars i get a different id
"id": "AAMkAGNiY2YxMjY3LTUxYjgtNGI1Yy1hOTM2LTU4MTM5OTZiNjdjYgBGAAAAAABW2gY0kRG1SqggDTNZN6i8BwBIq5JjIBY-RqWQllrF0GSkAAAAB353AAAPJkKZ1XJkQ6huFmcVa6XaAAGixNowAAA=",
"name": "Test",
Is there a way to match the (ews) calendar i already have to the one returned by the Graph API?
This is a shot in the dark, because I've never dug this deeply into the weeds on the Graph Ids, but you might try calling Graph with the header that selects "immutable ids." I tried to find some details on what this actually means without much luck.
The header is:
request.Header("Prefer", "IdType=\"ImmutableId\"");
HTH, and if not, sorry for guessing.

Microsoft Graph API Teams Chat Group

In Microsoft Teams When I add new users to a chat it creates a new "group" chat (not sure what it's called).
Add Users
Group Chat example
Is it possible to create groups like these with the Microsoft Graph API?
Maybe by the time this question was asked this was not possible, but right now MS Graph API allows this.
Here is an official link to documentation
From documentation if you would like to use REST API here is an example
POST https://graph.microsoft.com/v1.0/chats
Content-Type: application/json
{
"chatType": "group",
"topic": "Group chat title",
"members": [
{
"#odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["owner"],
"user#odata.bind": "https://graph.microsoft.com/v1.0/users('8c0a1a67-50ce-4114-bb6c-da9c5dbcf6ca')"
},
{
"#odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["owner"],
"user#odata.bind": "https://graph.microsoft.com/v1.0/users('82fe7758-5bb3-4f0d-a43f-e555fd399c6f')"
},
{
"#odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["owner"],
"user#odata.bind": "https://graph.microsoft.com/v1.0/users('3626a173-f2bc-4883-bcf7-01514c3bfb82')"
}
]
}
Please make sure to take care of the Authentication Microsoft Graph auth overview
There are also Microsoft Graph SDKs availalbe
Unfortunately, there is no such API to create a new chat group yet. There is already a feature request for the same here. You can watch the space for more updates

Google hangouts

I am working on an application in asp.net core. I want to add additional functionality for hangout. I want to ask is it possible to create hangout invite links in my asp.net application.
I have a scenario where I want to create hangout link and send the link to the client and book a digital meeting. Any suggestion?
As I mentioned in the comments, you can generate a Meet link with the Calendar API. To do so, create an Event with the following parameter and body:
conferenceDataVersion: 1
Request body:
{
"end": {
"date": "2020-07-08"
},
"start": {
"date": "2020-07-07"
},
"conferenceData": {
"createRequest": {
"requestId": "hangoutsMeet"
}
}
}
The insert API call will return, along with other fields, the hangoutLink parameter, which is ready to use in-browser:
"hangoutLink": "https://meet.google.com/id-of-the-meet",
References:
Resource representations
Insert event
Hope this helps!

Resources