Microsoft Graph API Teams Chat Group - microsoft-graph-api

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

Related

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

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.

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"
}
}
]
}

How to tell the difference between a SP Online drive and a Teams channel-drive?

Using the MSFT Graph API, is there a way to differentiate Drives (which are documentLibraries) that are used for Team-Channels versus those that are "simply" documentLibraries created WRT a more generic, SharePoint Online Site?
Retrieving a user's /v1.0/sites?search=* returns a union of SPO Sites the user is a member of and Teams the user is a member of. (Yes, Teams are SPO sites or libraries within a site natively.)
I need to differentiate either the Sites by whether or not they're a Team-Site (because I can then filter Drives returned), or specifically all the Drives returned to differentiate whether the Drive is a Channel-Drive or simply a plain-old documentLibrary that is part of a Site.
Retrieving Sites from Graph shows no apparent properties that indicate what "type" of Site it is, and neither do the Drives queried from each Site (/v1.0/sites/SITE-ID/drives).
Thanks.
One of the way can be check the owner of the drive associated with the site
GET https://graph.microsoft.com/v1.0/sites/{siteId}?$expand=drive
That endpoint will return site info including drive info
{
"description": "...",
"id": "xxx",
...
"drive": {
"description": "",
"id": "xxx",
"driveType": "documentLibrary",
...
"owner": {
"group": {
"email": "xxx",
"id": "42857780-3ab6-412d-a9b8-5e6adc73aabb",
"displayName": "xxx"
}
},
"quota": {}
}
If the owner has property group then you can use group id in the following endpoint
GET https://graph.microsoft.com/v1.0/groups/{groupId}?$select=id,resourceProvisioningOptions
Response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups(id,resourceProvisioningOptions)/$entity",
"id": "xxx",
"resourceProvisioningOptions": [
"Team"
]
}
select resourceProvisioningOptions which specifies the group resources that are provisioned as part of Microsoft 365 group creation, that are not normally part of default group creation. If one of the value is Team then the drive is used for teams.
Resources:
group

Create Microsoft Teams Meeting invite programatically using graph api

I am trying to create Teams Meeting invite via graph API but unable to figure out how to send meeting participants via the body as their documentation is not clear. I was using the graph API /me/onlineMeetings as mentioned here with the following body. I am not sure if this is the correct way, All I know is meeting timings, participant email ids. Can someone help me here?
Post request body:
{
"startDateTime":"2021-05-13T10:30:34.2444915-07:00",
"endDateTime":"2021-05-13T10:35:34.2464912-07:00",
"subject":"Testing Invite",
"meetingParticipants": {
"attendees": [{
"mail": "test#outlook.com"
}]
}
}
Yes, you can using graph API.
You need to update your meeting. Please refer to this Update onlineMeeting
You need to update participants property to add/remove attendees.
NOTE You can only modify the attendees field. You cannot update organizer field of the participants property.
To specify presenters and/or attendants please use the below structure.
To find additional information , please refer to the onlineMeeting Properties, and click though to the sub-objects such as attendees.
AFAIK you can not use the API to add presenters / attendees later.
{
"startDateTime": "{{startDateTime}}",
"endDateTime": "{{endDateTime}}",
"subject": "Meeting with {{Attendee_upn}} regarding {{$randomBs}}",
"autoAdmittedUsers": "EveryoneInCompany",
"participants": {
"organizer": {
"identity": {
"user": {
"upn": "jos#jvteams.xyz"
}
}
},
"attendees": [
{
"upn": "{{Attendee_upn}}",
"identity": {
"user": {
"id": "{{Attendee_id}}"
}
}
}
]
}
}

How to differentiate between Students and Teachers?

In the Microsoft Teams client SDK there is a userLicenseType property which we can use to determine if the user is a student or a teacher.
We want to do the same thing in our backend code to make sure that Students aren't running processes they shouldn't be, but we can't find an easy way of getting this same information from Microsoft Graph.
Does anyone know a way we can find this information? We were hoping it might be available through the access token or through /v1.0/education/me/ or /v1.0/me/ endpoints.
The educationUser has a similar property called primaryRole. You can retrieve this using /v1.0/education/me. Here is an example result:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/me/$entity",
"accountEnabled": true,
"displayName": "Megan Bowen",
"givenName": "Megan",
"surname": "Bowen",
"userPrincipalName": "MeganB#M365x214355.onmicrosoft.com",
"userType": "Member",
"id": "48d31887-5fad-4d73-a9f5-3c356e68a038",
"primaryRole": "teacher"
}

Resources