I am using the Microsoft.Graph library in .NET Core 3. I have a problem regarding change tracking using deltas. Suppose
I want to get changes via delta query using something like the code below:
ISecurityAlertsCollectionRequest page;
var page = await graphClient.Security.Alerts
.Delta()
.Request()
.GetAsync();
but it does not work. Which is the propper/correct way to get changes (alert details: like hostname, ipAddress etc.) via delta query in MS Graph. I red all the documentation about webhooks but I did not found any example or documentation related to delta queries for Security API changes. How can I achieve this?
Thank you!
Currently, Delta queries for Security API are not supported. Please raise the UserVoice
Related
I have an excel on line documents that can be edited by users in the Excel 365 web application.
I have an application that read this excel file with the graph api.
I have successfully managed to read the data from the file but when a user change the excel file and Excel says it has been saved, if I read the file immediately with my application I have old data.
I have to wait for 30s to have the updated data. Is there anything I can do to avoid this latency.
Here is my call to get the data :
var range = await _graphClient.Drives[_driveId].Items[_itemId].Workbook.Worksheets[workseetName]
.Range(rangeAddress).UsedRange(true)
.Request()
.GetAsync();
I posted a similar question on the graph API github repo. They responded here:
https://github.com/microsoftgraph/msgraph-cli/issues/215#issuecomment-1379391739
They suggest using the etag property to determine whether the workbook has changed since that last access. https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0
They also suggest using the Excel session. https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0#sessions-and-persistence
However in my personal testing the session method didn't fix the delay in excel saving the data in the backend.
They also mentioned:
"I cannot guarantee that these will work. I don't think this API was designed with real-time co-authoring in mind."
I am trying to get the Org contacts of my tenant using this Delta endpoint:
GET https://graph.microsoft.com/v1.0/contacts/delta
which is documented here.
Unfortunately, this is not returned the Address of my contacts. In order to retrieve the addresses, I am obliged to call this endpoint instead:
GET https://graph.microsoft.com/v1.0/contacts
The issue is that I need to call the Delta endpoint because that returns the DeltaToken that I can use in the future to only pull the list of modified/deleted contacts.
Is there any workaround to do this, without having to go through both endpoints, the first one to get the DeltaToken, and the second one to get the addresses of my contacts? (PS: I tried the expand option with no luck).
Thanks!
AFAIK, Currently address of contacts is not returned using this delta endpoint.
Being said that, consider filing uservoice for your specific ask so it could be considered for future implementations.
Thanks.
Microsoft recommends to use delta function in combination with Subscriptions/Notifications to synchronize mailbox. So my plan is:
Create subscription
Receive notification about new mail in inbox
Use delta function to get latest changes in the inbox
My mailbox already has several thousands of letters. If I run the query
https://graph.microsoft.com/v1.0/users/{id}/mailFolders/inbox/messages/delta
It will return in response #odata.nextLink with $skiptoken param many times and only after I get all the thousands of emails in my mailbox I will receive response with $deltatoken to track new changes.
Is there a way to get deltatoken after the first request? I don't want to synchronize the old messages. I want to skip all old messages in inbox and have a fresh start.
Today the delta query functionality does not support this scenario. To request new features please post ideas to uservoice
This is supported for some endpoints. You can use $deltaToken=latest to get just a deltaToken without any resource data. It's not, as far as I can tell, available for mailboxes… but who knows, maybe it will be soon.
This is not documented anywhere in the documentation for the specific APIs that do support it, but is instead documented in the Overview for change tracking. Why? Because Microsoft wants you to be sad all the time.
I need to take a count of each group from Azure AD using Graph API. Can anyone tell me how to achieve it
I also faced the similar issue. When I ran the end point mentioned in https://learn.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http#example-2-get-only-a-count-of-all-membership I got "$count is not currently supported."
However, if you notice the documentation clearly, it asks us to send in the ConsistencyLevel as eventual in the REST header. I got the correct response when I sent the header along with the call:
GET https://graph.microsoft.com/v1.0/groups/{id}/members/$count ConsistencyLevel: eventual
There is currently no Microsoft Graph endpoint to get the number of users.
You could list members by using:
GET https://graph.microsoft.com/v1.0/groups/{id}/members
And then handle the count of the members in your code.
See the reference here. Try it quickly with Microsoft Graph Explorer.
I am trying to use filter and orderby query parameters to sort or filter the results. But the API is ignoring the query parameters and returning entire results.
https://graph.microsoft.com/v1.0/sites/{site_id}/drives?orderBy=name%20desc
I'm not sure why this isn't documented in the Microsoft Graph documentation (it should be), but from the OneDrive API documentation itself:
Note that in OneDrive for Business and SharePoint Server 2016, the orderby query string only works with name and url.
I've added an issue to the documentation's repository so this issue can hopefully get resolved in the future.
Although the original OneDrive API docs/Graph Drive API docs state they support orderby, but the actual OneDrive Graph API should be have not support filtering or ordering results. So although we pass the orderby parameter, when Microsoft Graph sees a query parameter it doesn't expect, it simply ignoring the unknown filter/orderby parameter and returning us an unfiltered/default-sorted result.
My test string:
https://graph.microsoft.com/v1.0/sites/my-site-id/drives?$select=id, name,webUrl&$orderby=name%20desc
So the only suggestion for you is to vote up the existing feature request in User Voice or submit a new one.