Microsoft Graph Presence API

 Office 365, Microsoft Teams, Perumal
Mar 11 2020

In Microsoft Teams anyone can see other user’s availability status(presence) in the organization. Previously, there is no API call to access user’s presence information. Many clients have requested this feature in Graph. Now Microsoft Graph supports the Presence API in the beta version.

What is Presence?

Presence is part of a user’s profile in Microsoft Teams that indicates the user’s current availability and status to other users. Presence details are based on user’s availability and user’s activity.

Presence API

Presence Resource Type has of following methods

  • Get Presence – it gets user’s presence information
  • Get multiple user’s presence – it gets a list of user’s presence information

Presence Resource Type consists of following properties

  • Id – user id
  • Availability - The base presence information for a user. Possible values are Available, Away, BeRightBack, Busy, DoNotDisturb, Offline
  • Activity - The additional information to a user's availability. Possible values are Available, Away, BeRightBack, Busy, DonotDisturb, InACall, InAMeeting, Offline and so on.

To access Presence API calls, admin consent is needed. The Permissions needed are

  • Presence.Read
  • Presence.Read.All

Get Presence API call

Permission: Presence.Read, Presence.Read.All

Request Method: GET

Request API url: GET {userid}/presence

Retrieve specific user status by mentioning user id in request call.


HTTP/1.1 200 OK
Content-Type: application/json

	"id": "668xxxxx-xxxx-xxxx-xxxx-xxxxxxx",
	"availability": "Busy",
	"activity": "InACall"

Get multiple users Presence API call

Permission: Presence.Read.All

Request: Here we use Microsoft Graph Communication API to get multiple users status

Request Method: POST

Request API url:

Request body: Mention the user id separated by comma

	"ids": ["as3wxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "jh5rxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]


HTTP/1.1 200 OK
Content-Type: application/json
	"value": [{
			"id": "as3wxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
			"availability": "Busy",
			"activity": "InACall"
			"id": "jh5rxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
			"availability": "Available",
			"activity": "Available"

Export Teams Presence of all users using PowerShell Script

This PowerShell script export details of Microsoft Teams Presence in your tenant with the following information to a csv file

  • User Id
  • Display Name
  • Email Address
  • Availability
  • Activity


To run this script, you need to install SharePoint Online PnP module.

HTTP/1.1 200 OK
Content-Type: application/json

function Export-PresenceList
    param (  
        Connect-PnPOnline -Scopes "Group.Read.All","User.ReadBasic.All","Presence.Read","Presence.Read.All"
        $accesstoken =Get-PnPAccessToken
        $users= Get-MsolUser -all |select ObjectId
        $userslist = $users.ObjectId
        $body = @{"ids" = $userslist } | ConvertTo-Json
        $header = @{
                                  "Authorization"="Bearer $accesstoken"
        $presenceinfo = Invoke-RestMethod -Headers $header -Uri -Body $body -Method POST
        $presenceinfodetails= @()
        foreach($presence in $presenceinfo.value )
            $user=get-msoluser -ObjectId $ |select DisplayName,UserPrincipalName
            $userinfo = "" |select "UserId","Displayname","Emailaddress","availability", "activity"
            $userinfo.UserID = $
            $userinfo.Displayname = $user.DisplayName
            $userinfo.Emailaddress = $user.UserPrincipalName 
            $userinfo.availability =$presence.availability
            $userinfo.activity =$presence.activity
            $presenceinfodetails+= $userinfo
            $userinfo =$null
        $presenceinfodetails | Export-csv $ExportPath -NoTypeInformation
Export-PresenceList -ExportPath "C:\temp\teamspresencelist.csv"



Now using Presence API and script, we retrieved the user’s availability successfully.