r/GraphAPI • • Jul 24 '25

I'm running a graph api channel and wanted few suggestions on how can I make it better?

2 Upvotes

I have videos on virtually every topic now. I wanted to see if anyone has any idea on which direction I can take my channel to so it helps people from graph API community? https://youtube.com/@microsoftgraphexplorer?si=QNkqx_AATfOGCw1r


r/GraphAPI • • Jul 23 '25

Graph Api batching

Thumbnail
doitpshway.com
2 Upvotes

Post about a huge performance boost that you can have when using Graph Api batching.

But mainly a solution to all the problems it has (missing pagination support etc).


r/GraphAPI • • Oct 03 '25

How to connect ChatGPT with SharePoint/Teams without giving full tenant-wide access?

Thumbnail reddit.com
2 Upvotes

r/GraphAPI • • May 06 '25

Issues with Microsoft Graph Security Actions API - BlockIP not working despite proper permissions

3 Upvotes

Hey everyone,

I'm trying to implement the Microsoft Graph Security Actions API to block IPs using Microsoft Defender for Endpoint (P2 licensed). Despite having all the required permissions and setup, I'm running into issues.

What I've tried:

payload = {
    "name": "BlockIp",
    "actionReason": "Suspicious activity detected",
    "parameters": [
        {
            "name": "IP",
            "value": "192.168.1.100"
        }
    ],
    "vendorInformation": {
        "provider": "Microsoft Defender ATP",
        "vendor": "Microsoft"
    }
}

Setup:

  • Using Microsoft Graph beta endpoint (/beta/security/securityActions)

  • Have Microsoft Defender for Endpoint P2 license

  • Application has SecurityActions.ReadWrite.All permissions

  • Successfully getting access token

  • Using application permissions (not delegated)

Error:

The SecurityAction name is not supported or wrong. No provider result returned from provider task

Additional Info:

  • Same request fails in Graph Explorer

  • Tried different provider names:

    • "Windows Defender ATP"

    • "Microsoft Defender ATP"

    • "Microsoft Defender for Endpoint"

  • Using Python with requests library, but the issue seems API-related rather than code-related

  • Proper authentication is confirmed (getting valid access token)

  • API endpoint is responding (getting 400 error, not auth issues)

Has anyone successfully implemented the SecurityActions API for blocking IPs? The documentation seems sparse on actual implementation details.

Any help would be greatly appreciated!

Environment:

  • Microsoft Defender for Endpoint P2

  • Python requests library

  • Microsoft Graph API beta endpoint


r/GraphAPI • • Jun 18 '25

Graph API Log Tailing - Entra Sign In Logs

2 Upvotes

I wrote a script that pulls sign in logs from the graph api and then shoves them into a log file which flows thru: alloy -> loki -> grafana I plan to run the script every hour. I'm getting the timestamp of the last log and using that as a filter to only download new logs by incrementing it by one second. My question is: Does the api guarantee in some way that I'll get all logs for a given second? Example: I download sign in logs with createdDateTime ge 2025-06-18T20:54:26Z , and my last log I download has 2025-06-18T20:57:27Z . The script runs again with createdDateTime ge 2025-06-18T20:57:28Z . Is it possible there exists a log file after the one I downloaded at 2025-06-18T20:57:27Z ? If so, my method would miss that log. I suspect I'll just have to test this but was curious what other people do for tailing O365 logs into Grafana or SIEMS?


r/GraphAPI • • Oct 01 '24

Command to disable for all users

2 Upvotes

Trying to disable apps in M365. this works for 1 user. How do I get it to work for all users?

Get the services that have already been disabled for the user.

$userLicense = Get-MgUserLicenseDetail -UserId "[email protected]"

$userDisabledPlans = $userLicense.ServicePlans | Where ProvisioningStatus -eq "Disabled" | Select -ExpandProperty ServicePlanId

 

Get the new service plans that are going to be disabled

$e3Sku = Get-MgSubscribedSku -All | Where SkuPartNumber -eq 'SPE_E3'

$newDisabledPlans = $e3Sku.ServicePlans | Where ServicePlanName -in ("SHAREPOINTWAC", "SHAREPOINTENTERPRISE") | Select -ExpandProperty ServicePlanId

 

Merge the new plans that are to be disabled with the user's current state of disabled plans

$disabledPlans = ($userDisabledPlans + $newDisabledPlans) | Select -Unique

 

$addLicenses = @(

@{

SkuId = $e3Sku.SkuId

DisabledPlans = $disabledPlans

}

)

Update user's license

Set-MgUserLicense -UserId "[email protected]" -AddLicenses $addLicenses -RemoveLicenses @()


r/GraphAPI • • Jul 28 '24

How to set term items on uploaded files in SharePoint via Graph API

1 Upvotes

Hello everyone

I hope you can help me with a specific issue I am encountering.

I am currently working on uploading files to SharePoint via the Microsoft Graph API and need to update term items on these files once they are uploaded. While I have successfully figured out how to upload a file to SharePoint using the Graph API with application permission flow, I am running into problems when trying to set term items.

From what I've gathered, it seems that setting term items might not be possible with application permissions, though I found a discussion that suggests it could be managed in some way (Create term group in term store using Microsoft Graph API). Has anyone here had experience with this?

My main challenge is understanding how to set multiple term items on an uploaded document in SharePoint. I am unsure whether I am using the correct API call for this purpose. Specifically, I've looked at this documentation: Update term in term store using Microsoft Graph API, but I can't find any parameters indicating how to specify the document the term items should be applied to.

For context, I use the LargeFileUploadTask<DriveItem> to upload documents. I've seen several forum posts suggesting that it might not be possible to set term items at all. Can anyone confirm whether this is true or provide a solution? Is the API call mentioned above the correct one to use for setting term items on a document?

Any guidance or examples from those who have tackled similar issues would be greatly appreciated.

Thank you!


r/GraphAPI • • Sep 28 '24

Get Current Device

3 Upvotes

Hi Folks

Does anyone have any idea how to get some sort of identifier (presumably device ID) for the current device the user is logged in from, assuming it’s a managed device. Obviously null or false or whatever if it’s not.

I feel like I need the equivalent of the /me endpoint for users but for devices.

I don’t want the list of devices enrolled by the user, or managed by the user or any sort of list. Just the current device they are logged in from right now.

Use case is we have several label printers around the shop floor and certain workstations are right next to a label printer so want to be able to identify if the user is using one of them from our web app so the labels automatically print from those workstations to the local printer. Rather than the user having to pick a printer from a list. Labels are printed by a web api from the server to printer, not via windows.

Thanks

Nick


r/GraphAPI • • Dec 12 '24

Graph API for mailboxsettings

1 Upvotes

I am trying to enable Autoreply on a user's mailbox using the Graph API for an automation, but I am encountering an "access denied" error. I am a global admin and have already granted the appropriate permissions. I was wondering if anyone here has experience automating this specific
setting.

Example https://graph.microsoft.com/v1.0/users/[email protected]/mailboxSettings

{
    "error": {
        "code": "ErrorAccessDenied",
        "message": "Access is denied. Check credentials and try again."
    }
}

r/GraphAPI • • Dec 27 '24

Automate out of office email to all users in tenant

1 Upvotes

r/GraphAPI • • Jun 10 '24

Experiencing Calendar Access Removal Issue in Outlook 365 – Is This Normal?

Thumbnail self.outlook
2 Upvotes

r/GraphAPI • • Aug 14 '24

Differentiate Outlook Contact Email addresses

2 Upvotes

When using the graph api (I'm building a Powerapp) how do you differentiate between the email addresses returned by graph? Its JSON only shows address and name, but in Outlook it shows Personal, Work, and Other.

Response:

HTTP/1.1 200 OK

Content-type: application/json

{

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('48d31887-5fad-4d73-a9f5-3c356e68a038')/contacts/$entity",

"@odata.etag": "W/\"EQAAABYAAAAiIsqMbYjsT5e/T7KzowPTAAAYc8Bf\"",

"id": "AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAEOAAAiIsqMbYjsT5e-T7KzowPTAAAYbuK-AAA=",

"createdDateTime": "2017-09-04T15:54:01Z",

"lastModifiedDateTime": "2017-09-04T15:54:02Z",

"changeKey": "EQAAABYAAAAiIsqMbYjsT5e/T7KzowPTAAAYc8Bf",

"categories": [],

"parentFolderId": "AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OAAuAAAAAAAiQ8W967B7TKBjgx9rVEURAQAiIsqMbYjsT5e-T7KzowPTAAAAAAEOAAA=",

"birthday": null,

"fileAs": "",

"displayName": "Alex Wilber",

"givenName": "Alex",

"initials": null,

"middleName": null,

"nickName": null,

"surname": "Wilber",

"title": null,

"yomiGivenName": null,

"yomiSurname": null,

"yomiCompanyName": null,

"generation": null,

"imAddresses": [],

"jobTitle": null,

"companyName": null,

"department": null,

"officeLocation": null,

"profession": null,

"businessHomePage": null,

"assistantName": null,

"manager": null,

"homePhones": [],

"mobilePhone": null,

"businessPhones": [],

"spouseName": null,

"personalNotes": "",

"children": [],

"emailAddresses": [

{

"name": "[email protected]",

"address": "[email protected]"

}

],

"homeAddress": {},

"businessAddress": {},

"otherAddress": {}

}

Outlook MacOS


r/GraphAPI • • Sep 23 '24

Best practice for enterprise app permissions

2 Upvotes

Hello everyone,

we are currently developing a small application in .Net for internal stuff that relies heavily on the GraphAPI to send emails, retrieve emails from a shared mailbox, add users to groups etc.

Now we have somewhat of a stalemate between the developers and the sysadmins and after I searched through all the docs can’t really find a best practice approach.

As the app consists of different modules/functions that need different permissions like sendmail, receive mail etc. our sys admins say that each module needs his own Entra Enterprise registration.

The devs point of view is that the one application should be given all the rights it needs for all the modules.

I’m somewhere in the middle, with normal enterprise apps I put in scopes for admins, users etc. but it seems that isn’t the case if you are not using delegated access with GraphAPI but the approles.

Can anybody give me some pointers what would be the best way to handle this?


r/GraphAPI • • Aug 21 '24

How to check the installed apps of a device using Graph Explorer?

2 Upvotes

I'm having a difficult time in what to put in endpoint URL. I have tried any endpoint URL online but they don't work.


r/GraphAPI • • Dec 21 '24

Inexplainable bad request errors

1 Upvotes

Hello!

I have cooked a pretty basic workflow with the Python SDK of Graph and I am seeing a very weird behavior:

The code:

  1. Crawls a SharePoint library

  2. Gets oversized images ids in a list

Iterates over list and:

3. Downloads content and resizes

4. Deletes oversized item

5. Uploads with same name.

The code works except when...it doesn't. Intermittent errors are everyone's favorite right? And here comes the good part.

From my rudimentary logging I see that the function causing the error is the PUT request to create a new item. The replaced item causing the error has a weirdly malformed name: Normal name should be example.jpg but instead it shows as example(0).jpg. The driveItem ID is correct as is the parent ID. Which is weird because the error I get is 400 with message='Bad Request - Error in query syntax.'.

What is even weirder is that rerunning the code handles the previously offending item just fine.

This makes me think of possibly some kind of throttling, however throttling should throw 429 errors instead.

Any ideas welcome! Thank you!


r/GraphAPI • • Mar 04 '24

Setting mailbox permissions using GraphAPI

2 Upvotes

Am I correct in saying you can't currently set read/manage/sendas/etc. permissions of mailboxes using the GraphAPI?

Little rant: Is it me or is a lot of actually useful stuff not yet available in the GraphAPI? MS is slowely pushing everyone over to it which would be fine if it had all the same features available in the suite of Powershell Modules. This makes it almost impossible to create integrations with apps that do now use Powershell.


r/GraphAPI • • Mar 14 '24

Call out members of security groups including nested ones

1 Upvotes

Hi,

Is there an http syntax dedicated for members expand from group and each nested groups? Also how to avoid getting group itself in output. I work in power query, so I can't use advanced scripting.

Cheers and thanks in advance


r/GraphAPI • • Oct 17 '24

Seeking Help with Graph API Permissions for Meta Platforms Marketing Analysis

2 Upvotes

Hi everyone!

I’m currently working on a project to analyze how businesses in EU market themselves on Meta platforms, and I've hit a roadblock. We’ve been trying to extract data using the Graph API for a few weeks now but haven't had much luck.

We’ve verified our account and ensured that our token has all the necessary permissions enabled. However, we keep encountering issues indicating that our token lacks the right permissions. We haven’t applied for advanced permissions in our settings, but from what I’ve read in the documentation, it doesn't seem like that should be necessary.

Has anyone else experienced similar issues or can offer insights on how to properly set up permissions for the Graph API? Any tips or guidance would be greatly appreciated!

Thanks in advance for your help!


r/GraphAPI • • Aug 23 '23

Invalid value specified for property 'mailNickname' of resource 'User'

2 Upvotes

Hey, would like some help with this specific error:

New-MgUser_CreateExpanded:
Line |
   2 |  New-MgUser -DisplayName $User.FullName `
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Invalid value specified for property 'mailNickname' of resource 'User'.

Status: 400 (BadRequest)
ErrorCode: Request_BadRequest

Trying to add a bulk of new users using csv file. Using this code:

Foreach ($User in $New_users){
New-MgUser -DisplayName $User.FullName `
-PasswordProfile $PasswordProfile `
-AccountEnabled `
-MailNickname $User.NickName `
-UserPrincipalName $User.Email `
-Department $User.Dep `
-JobTitle $User.Title `
-Surname $User.Sur `
-GivenName $User.Giv `
}

Checked csv, no illegal symbols, seperation by comma and I can add users just fine manualy (copy all the info). Anyone could give any advice? Powershell 7 btw.

Thank you.


r/GraphAPI • • Oct 01 '24

Moving mail from shared mailbox to another shared mailbox

1 Upvotes

At the moment i use a pywin script to move al completere from all our 10+ mailboxen top one General subfolder of a shared mailbox. This saves us lots of time searching for mails. The same we do for sent items.

Since that i have full admin access to our graph api, I would rather to this process with the GraphAPI of course.

But as far as my research goes this is simply not possible. Do you guys know a way to achieve this with the API, or a way around? Or should we stick with the pywin script. Or a better way of work?


r/GraphAPI • • Jan 01 '25

Did /me/drive/special/photos/delta?expand=thumbnails just stop working?

2 Upvotes

For 2 years, I have been using the endpoint 

https://graph.microsoft.com/v1.0/me/drive/special/photos/delta?expand=thumbnails to sync the latest photos from special OneDrive photos folder including thumbnails.  3 days ago, suddenly started getting a 400 error on the URL.  So if I remove the expander, the endpoint works but now location:{} is empty too.

So did I miss a notification that features were going away?  Or is Graph seeing some issues right now?  

You can also reproduce in Graph Explorer with personal OneDrive.

Any one else seeing this behavior?


r/GraphAPI • • Aug 05 '24

Filters in Microsoft GraphAPI not wroking as expected and giving strange results

1 Upvotes

The Query below applies filter that timeOff entries'
sharedTimeOff/startDateTime >= formattedTodayDateTime and
sharedTimeOff/endDateTime <= formattedRequiredEndDateTime

which translates to formattedTodayDateTime <= timeOff's start_date and end_date <= formattedRequiredEndDateTime.

This query gives number of entries in response (non empty) .

// headers and accessTokens approprately formed
params = Map();
params.put("$filter","sharedTimeOff/startDateTime ge " + formattedTodayDateTime + " and sharedTimeOff/endDateTime le " + formattedRequiredEndDateTime + "");
response = invokeurl
[
    url :graphUrl
    type :GET
    parameters:params
    headers:headers
];

In below query, I am filtering for timeoff entries such that,

formattedTodayDateTime <= timeOff's end_date <= formattedRequiredEndDateTime.

params = Map();
params.put("$filter","sharedTimeOff/endDateTime ge " + formattedTodayDateTime + " and sharedTimeOff/endDateTime le " + formattedRequiredEndDateTime + "");
response = invokeurl
[
    url :graphUrl
    type :GET
    parameters:params
    headers:headers
];

Issue: Second query should give me more number of responses, but it gives me absolutely empty response.

I am expecting more entries in my response. But keep getting empty response.
I have tried changing query to formattedTodayDateTime <= timeOff's end_date <= formattedRequiredEndDateTime, this also gives me empty response.


r/GraphAPI • • Nov 18 '23

User API $top Limitation When Using &expand Question

1 Upvotes

Using pl/sql (12c) to pull down all users in Azure, flatten out the json and table the data.

If I use $select in combination with $top=999 I'm returned an array with 999 objects (key/pairs).

example: https://graph.microsoft.com/v1.0/users?$select=employeeId,onPremisesSamAccountName&$top=999 [this returns 999]

However, if after the $select, I add $expand=manager($levels=1;$select=id), regardless of the $top value, I'm only returned 200.

example: https://graph.microsoft.com/v1.0/users?$select=employeeId,onPremisesSamAccountName&$expand=manager($levels=1;$select=id)&$top=999 [this only returns 200]

Is this a known limitation due to the query parameters of 'select' and 'expand' in the same request? When the number of users in Azure is ~44k, having 200+ get iterations to pull all the data seems excessive.

Any advice would be helpful. I'm open to ideas/criticism.

Regards.


r/GraphAPI • • Mar 14 '24

Find all licensed users

2 Upvotes

Trying to find all users with a license

This works

https://graph.microsoft.com/v1.0/users?$filter=assignedLicenses/$count ne 0&$count=true&$select=displayName,mail,userPrincipalName,id,userType,assignedLicenses&$top=999

This doesn't

and I have no idea why - I have put consistency level = eventual into Graph explorer.

https://graph.microsoft.com/beta/users?$filter=AssignedLicense/$count ne 0&$count=true&$select=Surname,Givenname,Displayname,onpremisesextensionattributes,JobTitle,BusinessPhones,Mobilephone,Faxnumber,mail,streetaddress,city,state,postalcode,manager,department,companyname,officelocation,signinactivity,assignedlicenses&$count=true&$expand=manager($select=displayName)

I get the error:

message: "Expect simple name=value query, but observe property 'assignedLicenses' of complex type 'AssignedLicense'.",

I can get $filter=assignedLicenses/any(x:x/skuId+eq+[number] working but I just need to see all users with a license.