Does Microsoft Graph have lastModifiedDateTime to detect latest entity changes? - microsoft-graph-api

Some of the Graph API return a lot of data and require paging. Exists a lastModifiedDateTime property to get only changed rows, such as to make this call that returns users who are modified since a given date?
https://graph.microsoft.com/beta/users?$filter=lastModifiedDateTime gt '2020-01-01T12:00:00Z'
or get the classes that have changed (Educational API)
https://graph.microsoft.com/beta/education/classes?$filter=lastModifiedDateTime gt '2020-01-01T12:00:00Z'

The Property you are trying i.e., 'lastModifiedDateTime' is not part of the MS Graph.
In Ms Graph this is possible with directoryAudits method which contains all information related to changes(logs) in Azure AD.
To Get the last activity in azure you need to use 'activityDateTime' property and to get the user information 'initiatedBy' property.

Related

Graph Bookings API - List appointment returning empty customers array

When invoking either
GET /solutions/bookingBusinesses/{id}/calendarView
or
GET /solutions/bookingBusinesses/{id}/appointments
the returned bookingAppointment object has an empty customer array. However the customers appear in the UI. Any idea why this may be the case?
Looks like a bug in Graph API.
According to the documentation the customers property is optional. Sometimes you have to specify optional property in $select statement.
GET solutions/bookingBusinesses/{id}/calendarView?start=2018-04-30T00:00:00Z&end=2018-05-10T00:00:00Z&$select=customers
Another option is trying beta version instead of v1.0
GET beta/solutions/bookingBusinesses/{id}/calendarView?start=2018-04-30T00:00:00Z&end=2018-05-10T00:00:00Z

Can't retrieve outlook add-in custom properties from graph API

I need to save a custom property from my outlook add-in and retrieve the this value from graph Api.
I followed MS documentation, this link and this one.
I store the custom property with office.js methods loadCustomPropertiesAsync and customProps.saveAsync
I have checked the value is correctly stored to custom properties (I can read it from add-in when I come back to event)
When I try to check the value from graph API, the event is returned without custom props.
here is the request I use :
{{endpoint}}/Users/bc2d0290-xxx-4041d2d39b66/Events/AAMkADI1YTJjZTI1LWM4YjUtNxxxTvAAA=?$expand=singleValueExtendedProperties($filter=id eq 'String {00020329-0000-0000-C000-000000000046} Name cecp-myAddInManifestId')
What am I doing wrong ?
I found my mistake.
I use custom properties to enrich appointements with conference room.
I tried to retrieve custom props on my server from room eventId instead of organizer eventId

Get extended properties in office 365 graph delta API

We are building an application that integrates office 365 using graph APIs. We need to pull all the office 365 contacts into our system and needs to be in sync.
There is delta API in office to pull only delta changes. We found an issue like we can not pull extended properties(Which includes outlook MPAI fields like mobile phone, assistant phone, etc)
GET https://graph.microsoft.com/v1.0/me/contacts/delta
So office 365 expects the client to make extra API call to get extended properties for each contact?
Means if the user has 1000 contacts, the client has to make 1000 plus API calls to pull the contacts from office365?
There is another contact search API which supports extended properties in a single call. Can we use this to pull the delta changes?
GET https://graph.microsoft.com/v1.0/me/contacts?$filter=lastModifiedDateTime gt '2018-07-28T05:25:32Z'
Please advice us how we can effectively pull office365 contacts
Thanks in advance!
As far as i can see (and observed myself with calendar events) expand is not supported for most delta query calls. See doc for delta query under Optional Query Parameters:
$expand is only suported for the manager and members navigational property for users and groups respectively.
Your filter request is also not supported for delta query. If u use :
GET https://graph.microsoft.com/v1.0/me/contacts/delta?$filter=lastModifiedDateTime gt 2018-07-28T05:25:32Z
You get the following error:
"error":
{
"code": "ErrorInvalidUrlQuery",
"message": "The following parameters are not supported with change tracking over the 'Contacts' resource: '$orderby, $filter, $select, $expand, $search, $top'.",
"innerError":
{
"request-id": "da1174b3-d...",
"date": "2018-08-06T12:45:34"
}
}
Funnily enough select is actually supported (contact delta doc).
Any way it seems like your only choice is to expand the normal contact request for a user.
If there are a lot of changes, you could try batching the expanded contact requests.

Select=*,PropertyName does not return the value for the PropertyName in Microsoft Graph api

In Graph Explorer if i make a request to:
/v1.0/users/[User.Id]/drive/root/children?$select=*,sharepointIds
I do not get back the sharepointIds property from MS Graph.
If I remove * from select query parameter and only request sharepointIds property then I get the sharepointIds property and its values.
v1.0/users/[User.Id]/drive/root/children?$select=sharepointIds
I would expect $select=*,sharepointIds to return both the default properties and the sharepointIds in the same response.
Is there another working way for the clients to request additional properties from Microsoft Graph without typing all of the property names in the object one by one including the default properties?
The underlying OneDrive API seems to handle select=*,[propertyName] correctly.
This isn't possible today. Microsoft Graph currently doesn't support wildcards in a $select query parameter. Each property you want to return must be explicitly listed in the $select.

Unable to expand MemberOf using Microsoft Graph .NET SDK using Delta Query

Expanding properties doesn't seem to work when using Delta queries. It works fine with regular user query.
Is this a limitation in Microsoft Graph API?
var usersInfo = graphServiceClientWithApplicationPermission.Users.Delta().Request().Expand("MemberOf").GetAsync();
// Add inital request users
foreach (var userInfo in usersInfo)
{
// Member info doesn't seem to be expanded even if $expand=MemberOf is sent
if (userInfo.MemberOf == null)
{
userInfo.MemberOf = await applicationPermissionsClient.Users[userInfo.Id].MemberOf.Request().GetAsync();
}
// MemberOf is now populated ??
}
Seems like this is another limitation of the Microsoft Graph and not supported.
Optional query parameters
If a client uses a query parameter, it must be specified in the
initial request. Microsoft Graph automatically encodes the specified
parameter into the nextLink or deltaLink provided in the response. The
calling application only needs to specify their desired query
parameters once upfront. Microsoft Graph adds the specified parameters
automatically for all subsequent requests. For users and groups, t
here are restrictions on using some query parameters:
If a $select query parameter is used, the parameter indicates that the
client prefers to only track changes on the properties or
relationships specified in the $select statement. If a change occurs
to a property that is not selected, the resource for which that
property changed does not appear in the delta response after a
subsequent request. $expand is not supported.
For users and groups beta (preview) APIs, scoping filters allow you to
track changes to one or more specific users or groups by objectId. For
example, the following request:
https://graph.microsoft.com/beta/groups/delta/?$filter= id eq
'477e9fc6-5de7-4406-bb2a-7e5c83c9ae5f' or id eq
'004d6a07-fe70-4b92-add5-e6e37b8acd8e' returns changes for the groups
matching the ids specified in the query filter.
https://developer.microsoft.com/en-us/graph/docs/concepts/delta_query_overview

Resources