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.
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?
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.
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.
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.
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.
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?
I have cooked a pretty basic workflow with the Python SDK of Graph and I am seeing a very weird behavior:
The code:
Crawls a SharePoint library
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.
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.
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.
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!
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.
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?
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,
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.
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.
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.