r/GraphAPI • • May 22 '25

Using GET request to retrieve signinactivity

0 Upvotes

I'm using PowerShell to retrieve directory information from the below endpoint using invoke webrequest. When I put the results of the request into a variable every object is a different user, so running "$results" returns all of the users and their profile info except for sign-in info.
The issue I'm having is if I try to select "$results[1].signInActvity" to drill down to a specific users's sign-in date, it returns nothing.

$endpoint = 'https://graph[.]microsoft[.]com/beta/users/?$select=signInActivity'

I'm on an Entra P1 license invoking the web requests from Powershell and the app I'm using has AuditLog.Read.All, Directory.Read.All, and User.Read permissions (which as I understand it should be way overkill)


r/GraphAPI • • Jul 14 '25

Connect graph api with function app using managed Identity

0 Upvotes

r/GraphAPI • • Dec 04 '25

I need to programmatically access Archived in place mailbox

Thumbnail reddit.com
0 Upvotes

r/GraphAPI • • Aug 22 '22

Change notification for opened email

0 Upvotes

Is it possible to receive change notification if receiver opened the email?


r/GraphAPI • • Dec 05 '24

Automate Azure AD app creation using Graph API

0 Upvotes

r/GraphAPI • • Dec 31 '24

Microsoft Graph does not work

0 Upvotes

Microsoft needs to stop moving the management of services (Sharepoint, Purview, etc) to MS Graph. It does not work consistently and is impossible to troubleshoot.

A simple GET https://graph.microsoft.com/beta/security/labels/retentionLabels/id is apparently impossible for MS Graph to keep working. Forget actually trying to get the event type or disposition rules of those labels. After having a support request open for months and eventually getting it to a state of half working, it's just broken again.

It seems that when the management of the product is divorced from the actual product you're trying to manage, it's impossible to get anything fixed.


r/GraphAPI • • Mar 30 '24

Grab

Thumbnail
linkedin.com
0 Upvotes

Instabridge​ ​Grab​X​


r/GraphAPI • • Apr 02 '24

Special folder with item-id

0 Upvotes

Given an item-id, what is the correct way to figure out if it belongs to any special folder. As far as i looked into, special folder is attributed to folder and not file


r/GraphAPI • • Apr 30 '25

Use managed Identity to connect with Microsoft graph

1 Upvotes

I have used logic app to query graph api using managed Identity. https://youtu.be/HDeVDYcsxNY


r/GraphAPI • • Jul 30 '25

Get notified on Azure secrets using function app

1 Upvotes

r/GraphAPI • • Dec 07 '25

How can I get both Defender API + Graph API tokens with a single MSAL login?

1 Upvotes

Hi everyone,

I'm using MSAL and I want to sign in once, but acquire two tokens:

My flow right now:

  1. Interactive login → request Defender scopes

  2. extraScopesToConsent = graphScopes

  3. After login I try to get Graph token silently

  4. Silent fails → MSAL opens a second login window

What I want:

✔ One single login window
✔ User consents to both Defender + Graph scopes at the same time
✔ Then: Defender token + Graph token (no second prompt)

My question:

👉 Is it possible to get tokens for two different resources (Defender + Graph) with one interactive MSAL login?
Should I merge all scopes into one request, or is the second login unavoidable due to different resource audiences?

Any working solution or best practice is appreciated.


r/GraphAPI • • Aug 09 '25

Automating non complaint device reports from Intune 😎

2 Upvotes

r/GraphAPI • • Aug 19 '23

The weird result when using MS Graph for Access Review on Owners

4 Upvotes

Greetings,

I am trying to create an Azure Access Review which includes both members and owners for the review process, where the group owners are also the reviewer in said Access Review. Since there are over 500+ groups in our tenant, I am using Microsoft Graph to automate this using a powershell script.

When I use the members value in the request body, everything works out fine, but when I use owners in the request body, I get a weird result which I was able to replicate using the MS Graph Explorer.

Link to the MS Graph Explorer: Graph Explorer | Try Microsoft Graph APIs - Microsoft Graph

You got to consent under the Modify permissions tab

As an exercise, I used the MS Graph explorer for the following:

Best Case Scenario

POST (beta): https://graph.microsoft.com/beta/identityGovernance/accessReviews/definitions

Request Body:

{
    "displayName": "Group Members Access Review",
    "descriptionForAdmins": "Reviews access to all group members in the organization",
    "reviewType": "AccessReview",
    "scope": {
        "query": "/groups/{group id}/members",
        "queryType": "MicrosoftGraph"
    }
}

Result is:

The access review is successfully created in Azure. You can see it in the GUI on the web.

=====================

Bad Case Scenario

POST (beta): https://graph.microsoft.com/beta/identityGovernance/accessReviews/definitions

Request Body:

{
    "displayName": "Group Owners Access Review",
    "descriptionForAdmins": "Group owners in the organization",
    "reviewType": "AccessReview",
    "scope": {
        "query": "/groups/{group id}/owners",
        "queryType": "MicrosoftGraph"
    }
}

The result is:

{
    "error": {
        "code": "",
        "message": "PartnerData | Partner Record with Id 00000000-0000-0000-0000-000000000000 not found in repository",
        "innerError": {
            "date": "2023-08-18T16:17:48",
            "request-id": "{request id auto-generated}",
            "client-request-id": "{client-request-id auto-generated}"
        }
    }
}

I get the same exact result in my script. I don’t have this PartnerData in my tenant, but I get the feeling this is something from within Graph API...maybe. 

Any ideas?


r/GraphAPI • • Mar 25 '25

Microsoft Graph Query

3 Upvotes

Hi,

I'm trying to use Microsoft Graph to find out which users in the organisation are using service that has an E5 license dependency but the user is not licensed for E5,

I'm trying to run something like the below but the script runs infinitely

# Connect to Microsoft 365
Connect-MgGraph -Scopes "User.Read.All, Directory.Read.All"

# Define the E5 license SKU
$e5Sku = "ENTERPRISEPREMIUM"

# Define the E5 services (example services, adjust as needed)
$e5Services = @("PowerBIPro", "MyAnalytics_Premium", "Teams_Advanced_Comms")

# Get all users
$users = Get-MgUser -All

# Initialize an array to store the results
$results = @()

# Loop through each user and check their licenses and service usage
foreach ($user in $users) {
    $hasE5License = $false
    foreach ($license in $user.AssignedLicenses) {
        if ($license.SkuId -eq $e5Sku) {
            $hasE5License = $true
            break
        }
    }

    if (-not $hasE5License) {
        $licenseDetails = Get-MgUserLicenseDetail -UserId $user.Id
        foreach ($license in $licenseDetails) {
            foreach ($service in $license.ServicePlans) {
                if ($service.ServicePlanId -in $e5Services) {
                    $results += [PSCustomObject]@{
                        UserName = $user.DisplayName
                        UserPrincipalName = $user.UserPrincipalName
                        UnlicensedService = $service.ServicePlanName
                    }
                }
            }
        }
    }
}

r/GraphAPI • • Apr 08 '25

Scopes for Microsoft Graph Command Line Tools

2 Upvotes

In Entra under the sign in logs for Microsoft Graph Command Line Tools I can see which user has logged in to the app context. Under the Addtional Details I can also see the scopes that the user used when trying to log in. So the data is there and I can access it. Does anyone have a Powershell script on how I can get this data? I have already made several attempts to get the data, also via chatgpt. I just can't get it to display the scopes for the sign in


r/GraphAPI • • Apr 11 '25

Simple MS Graph API PowerShell Module

2 Upvotes

Hi all,

For a larger Entra ID enumeration script, I wanted to move away from the official Microsoft Graph PowerShell modules, since they’re not always available on customer systems. Furthermore, some API calls are not available (PIM for Group related stuff).

I ended up creating a simple, single-file PowerShell module to work directly with the Graph API.

It handles the usual stuff like:

  • Automatic Pagination

  • Retry logic (with backoff for throttling (HTTP 429), or other errors like HTTP 504 etc.)

  • v1.0 / beta endpoint switch

  • Query parameters and custom headers

  • Simple proxy support

  • Basic error handling and logging

Maybe it is useful for someone else: https://github.com/zh54321/GraphRequest


r/GraphAPI • • Apr 10 '23

Access to Another User's OneDrive (GraphAPI and Microsoft.Graph issues)

5 Upvotes

I'm using Azure Functions with a managed identity to grant a user access to another user's OneDrive (for example, a manager to a employee who has left).

I have Graph API queries to get the DriveID of the user, but I can't seem to find any Graph API queries that would grant access to a OneDrive. There are some actions for creating a shareable link, but these links would be open to any one who has the link. I want to grant permissions to a specific permission.

Likewise, I've tried using the Grant-MgUserDriveRootPermission Microsoft.Graph cmdlet, but it either returns that it can't find the resource or that the DriveID is not in the correct format. The documentation does not specify what the DriveID should look like, and I've tried using the IDs from both Get-MgUserDrive, Get-MgUserDefaultDrive, and Get-MgUserDriveRoot.

Has any one used Graph API to grant a user access to another user's OneDrive or been able to use any type of Microsoft.Graph PowerShell cmdlets to do the same?


r/GraphAPI • • Jul 16 '25

Getting SharePoint Managed Metadata Fields via Graph API

2 Upvotes

I'm running into an issue with the Microsoft Graph API and could really use some help.

I'm trying to retrieve the value of a managed metadata field from a SharePoint list item. When I execute the following request on my test SharePoint environment, everything works fine and I receive the expected metadata (also Term value):

Request:

https://graph.microsoft.com/v1.0/sites/test.sharepoint.com,c**************/lists/************/items/46/fields?$select=Categori

and production url:

https://graph.microsoft.com/v1.0/sites/prod.sharepoint.com,0**************/lists/********************/items/22292/fields?$select=Client

Response (for demo the Graph Explorer used):


{
    "@odata.context": "***************",
    "@odata.etag": "***********",
    "@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET sites('<key>')/lists('<guid>')/items('<key>')/fields?$select=id",
    "Categori": [
        {
            "Label": "Anleitungen",
            "TermGuid": "508ba****************",
            "WssId": 1
        }
    ]
}

However, when I try the same request in the production environment, targeting a different metadata field (named Client), the field is always returned empty, even though it has a value in the SharePoint UI.

Response in production:

{
  "AdditionalData": {
    "@odata.context": "***************",
    "@odata.etag": "****************",
    "Client": {}
  },
  "BackingStore": {
    "ReturnOnlyChangedValues": false,
    "InitializationCompleted": true
  },
  "Id": null,
  "OdataType": null
}

A few additional details:

  • The Client field in production is a single-value managed metadata field (unlike Categori in test, which is multi-value). But I also tried when Client is set to multi-value.

  • I’ve tried various combinations of $select and $expand, but the result is always the same.

  • Interestingly, I can successfully update the Client field from the c# application using the guidance from this StackOverflow post, so write access works.

  • Other custom fields (non-managed metadata) return values correctly.

  • I'm using the Microsoft Graph SDK for .NET (Microsoft.Graph version 5.56.0).

and the request is made like that:

   var result = await graphServiceClient.Sites[siteId].Lists[listId].Items[listItemId].Fields.GetAsync((requestConfiguration) =>
                    {
                        requestConfiguration.QueryParameters.Select = new string[] { "client" };
                    });

Has anyone experienced a similar issue where a managed metadata field (especially a single-value one) returns an empty object when reading through Graph API, despite having a value?

Any ideas on what could be wrong or what else I could try?

Thanks in advance!


r/GraphAPI • • May 02 '25

Access messages from one-on-one chat belonging to different tenant using MS Graph application

3 Upvotes

Hi everyone! My company wants move from MS Teams to a different platform, but we do want to save the chat history and it seems to be a bit unreachable. I did a few tests and the main problem now is the following:

The problem

I have two accounts, each belonging to different tenant - one belongs to my organization and another - my personal account. I wrote a message from the personal account to org. account. The chat was created and it's considered as a different tenant chat. If I try to get the messages from this chat via MS Graph application registered on org. tenant I get 403 via the following APIs:

  • /users/{user-id}/chats/{chat-id}/messages

  • /chats/{chat-id}/messages

And the following error message:

The initiator {initiatorId} does not have permission to access thread {threadId}. Tenant Id mismatch.

The official documentation page says that it's not possible because of security reasons:

To list chat messages in application context, the request must be made from the tenant that the channel owner belongs to (represented by the tenantId property on the channel).

The workaround

So it seems that there's no way to get the messages from the chat via Graph API, right? Wrong! I found another API that retrieves all messages from all user chats:
/users/{user-id}/chats/getAllMessages

This endpoint allows to get all messages accross all user chats, even the ones that belong to different tenant (!!!). You can then group the messages by chatId and get the wanted result. By there's a little catch - it's a paid API. So I guess that we can forget about security if we pay money for it?

The question

So something tells me that there should be some way to get the messages from this kind of chats and maybe someone knows how to do it? No way you can get secured data via paid API. If it's even works, then we can consider that this data isn't so secure.

Would be glad if anyone will have some piece of information on that. Thanks!


r/GraphAPI • • Mar 25 '25

Send message to private channel in Teams

2 Upvotes

Is it possible to send a message to a private channel in Teams via Graph / CURL?

We have read many recommendations to solve this via Power Automate / Flow, but this probably does not work with private channels “Sending a message in private channels isn't supported.”

https://learn.microsoft.com/en-us/power-automate/teams/send-a-message-in-teams

In principle there is a good documentation: https://learn.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-1.0&tabs=http

and also an example in Graph Explorer:
https://developer.microsoft.com/en-us/graph/graph-explorer
https://graph.microsoft.com/beta/teams/{group-id-for-teams}/channels/{channel-id}/messages

What I don't understand is how to set the permissions on AzureSite, if I understand correctly, this is only possible as a delegated user and not as an application.
https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=powershell#tabpanel_1_powershell

Sending message to a channel is not supported with application permissions, it is only supported in delegated context. Application permissions are only supported for migration. Please refer these documents to send message to a channel using Graph in delegated context -

https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=powershell#tabpanel_1_powershell

https://learn.microsoft.com/en-us/powershell/microsoftgraph/get-started?view=graph-powershell-1.0

Can anyone help me with step-by-step instructions on how (or whether) this can be solved?

Thx a lot.


r/GraphAPI • • Mar 11 '26

Graph Explorer down?

2 Upvotes

r/GraphAPI • • Jul 27 '25

Delta queries in Action 😎

2 Upvotes

r/GraphAPI • • Jan 06 '26

WhatsApp Cloud API phone number stuck as unregistered despite full approval (business, app, permissions)

Thumbnail reddit.com
2 Upvotes

r/GraphAPI • • Mar 21 '25

Sharepoint site permission assignment via GraphAPI broken?

2 Upvotes

Hi There

Just trying to define a site for the GraphAPI permission "Sites.Selected" in a app registration.
The following applies:

- Roles: Sharepoint Admin, Application Developer
- Site owner of the respective Sharepoint site

The Powershell snipped i've try to run:

Connect-MgGraph -Scopes "Sites.Manage.All"
$AppID = "8866c719-6ec4-4ec4-ad02-83e27ccdfd99" #Randomized
$SiteID = "foobar.sharepoint.com,a1b2c3d4-5678-90ab-cdef-1234567890ab,9876fedc-ba09-8765-4321-abcdef123456"  #Randomized

$Body = @{
    roles = @("write")
    grantedToIdentities = @(@{ application = @{ id = $AppID } })
} | ConvertTo-Json -Depth 3

$Uri = "https://graph.microsoft.com/v1.0/sites/$SiteID/permissions"
Invoke-MgGraphRequest -Uri $Uri -Method POST -Body $Body -ContentType "application/json"

The Error i get looks about like this (Randomized as well):

Invoke-MgGraphRequest : POST https://graph.microsoft.com/v1.0/sites/foobar.sharepoint.com,a1b2c3d4-5678-90ab-cdef-1234567890ab,9876fedc-ba09-8765-4321-abcdef123456/permissions
HTTP/1.1 403 Forbidden
Transfer-Encoding: chunked
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
request-id: 98765432-abcd-4321-efgh-567890abcdef
client-request-id: abcdef12-3456-7890-abcd-ef1234567890
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"SomeRegion","Slice":"X","Ring":"Y","ScaleUnit":"123","RoleInstance":"XYZ123"}}
Link: <https://developer.microsoft-tst.com/en-us/graph/changes?$filterby=v1.0,Removal&from=2021-09-01&to=2021-10-01>;rel="deprecation";type="text/html", <https://developer.microsoft-tst.com/en-us/graph/changes?$filterby=v1.0,Removal&from=2021-09-01&to=2021-10-01>;rel="deprecation";type="text/html"
Deprecation: Fri, 03 Sep 2021 23:59:59 GMT
Sunset: Sun, 01 Oct 2023 23:59:59 GMT
Cache-Control: no-store, no-cache
Date: Fri, 21 Mar 2025 10:02:10 GMT
Content-Encoding: gzip
Content-Type: application/json
{"error":{"code":"accessDenied","message":"Access denied","innerError":{"date":"2025-03-21T10:02:10","request-id":"98765432-abcd-4321-efgh-567890abcdef","client-request-id":"abcdef12-3456-7890-abcd-ef1234567890"}}}

What am I doing wrong?
Has Microsoft removed GraphAPI support for assigning site permissions?