Can not get bulk manager data from Microsoft graph - microsoft-graph-api

I want to get all user's and their corresponding manager data from the organization.
In Microsoft Graph explorer I do this:
request: GET V1.0
url: https://graph.microsoft.com/v1.0/users?$select=displayName,manager
privileges: I select all existing privileges from the list.
Data for the manager is not coming. But I can see the data for "displayName".
For each user when I separately do a request like this:
https://graph.microsoft.com/v1.0/users/{...user id...}/manager
then I can get the manager data, but I can not get it bulk from the /users?$select endpoint. The organization has 1200 users And I don't want to make 1200 requests to Graph API to get the manager data for each user, instead I want to get the manager data in one request (bulk).
Can please someone help me with this?

Try this :
https://graph.microsoft.com/v1.0/users/<user obj id>?$expand=manager
Result:

Related

Microsoft Graph API GET onlineMeeting via joinUrl

Current using Microsoft Graph API v1.0 to create onlineMeetings via POST /me/events. Reason being, if you create an onlineMeeting directly and add a user in the meeting, it doesn't create a calendar event.
The params I use for that call is:
:isOnlineMeeting => true,
:onlineMeetingProvider => "teamsForBusiness"
Which works great and returns a joinUrl under onlineMeetings.
However, I'd like to pull attendance data from the GET onlineMeeting route to get attendance information since the attendees section of the event only seems to return users that were added to the actual event, not who attended the actual onlineMeeting.
I have tried doing a get request like such:
/v1.0/me/onlineMeetings?$filter=joinWebUrl%20eq%20'https://whateverthejoinurlis'
but the response says it's not a valid filter.
Any guidance would be appreciated.
Posting the Answer for better knowledge
Copying from #Shiva Keshav Varma comments
Try it in beta version
/beta/me/onlineMeetings?$filter=joinWebUrl%20eq%20'https://whateverthejoinurlis
You can also get the attendeereport using beta/users/{userId}/onlineMeetings/{meetingId}/attendeeReport as specified in the document.

Microsoft GraphApi: how to filter SPO results

I have a SPO site within a SPO site collection.
My site has a DocumentLibrary and inside it 3 folders (Alfa, Beta and Gamma): I would like to get get the ID of one of them (for example Beta) by Graph API.
I can get all of them by writing:
https://graph.microsoft.com/v1.0/sites/[id site collection]/sites/[id site]/drives/
I can select a specific fields:
https://graph.microsoft.com/v1.0/sites/[id site collection]/sites/[id site]/drives?$select=name,id
but I can't filter the results, the following requests return always the same results of the first one:
https://graph.microsoft.com/v1.0/sites/[id site collection]/sites/[id site]/drives?$filter=name eq 'Beta'
https://graph.microsoft.com/v1.0/sites/[id site collection]/sites/[id site]/drives?filter=name eq 'Beta'
. Does anyone know why and explain me how to filter?
Thanks in advance.
As of now you cannot use ODATA query parameter $filter to filter the document libraries as it is documented that it can support only few query parameters. There is already a feature request raised in Microsoft Graph Feedback Forum, please upvote it so that the product team may develop it in future.
For now you should query it on your end(Client side) using list drives and pick the required drive object by the name property from drive objects listed.

C# MsGraph-SDK: Send a BatchRequest to get manager links using Microsoft Graph SDK

First of all please share if there is any MSGraph SDK official documentation anywhere that I can use for reference.
I have a scenario, where I want to query all manager and member links from AAD without providing the user and group objectID respectively. This is currently supported in DQ channel, i.e. I can do something like this using MsGraphSDK:
MsGraphClient.Users.Delta().Request().Select("manager")
OR
MsGraphClient.Groups.Delta().Request().Select("members")
I don't want to use DQ for initial-sync due to performance problems, and other issues.
My fallback option is to query through Graph directly, so I want to do something like the following, but this doesn't return any result:
MsGraphClient.Users.Request().Select("manager")
OR
MsGraphClient.Groups.Request().Select("members")
It looks like this isn't even supported currently at the lower (AADGraph) layer. Please correct me if I am wrong, and provide a solution if any!
So my fallback approach is to pull all the user and group aadObjectIds, and explicitly query the manager and member links respectively.
In my case, there can potentially be 500K User-Objects in AAD, and I want to avoid making 500K separate GetManager calls to AAD. Instead, I want to batch the Graph requests as much as possible.
I wasn't able to find much help from the Internet on sending Batch requests through SDK.
Here's what I am doing:
I have this BatchRequestContent:
var batchRequestContent = new BatchRequestContent();
foreach (string aadObjectId in aadObjectIds)
{
batchRequestContent.AddBatchRequestStep(new BatchRequestStep(aadObjectId, Client.Users[aadObjectId].Manager.Request().GetHttpRequestMessage()));
}
and I am trying to send a BatchRequest through GraphSDK with this content to get a BatchResponse. Is this currently supported in SDK? If yes, then what's the procedure? Any documentation or example? How to read the batch-response back? Finally, is there any limit for the # of requests in a batch?
Thanks,
Here is a related post: $expand=manager does not expand manager
$expand is currently not supported on the manager and directReports relationships in the v1.0 endpoint. It is support in the beta endpoint but
the API returns way to much throw away information: https://graph.microsoft.com/beta/users?$expand=manager
The client library partially supports Batch at this time although we have a couple of pull requests to provide better support
with the next release (PR 1 and 2).
To use batch with the current library and your authenticated client, you'll do something like this:
var authProv = MsGraphClient.AuthenticationProvider;
var httpClient = GraphClientFactory.Create(authProv);
// Send batch request with BatchRequestContent.
HttpResponseMessage response = await httpClient.PostAsync("https://graph.microsoft.com/v1.0/$batch", batchRequestContent);
// Handle http responses using BatchResponseContent.
BatchResponseContent batchResponseContent = new BatchResponseContent(response);

Not able to filter messages based on header properties in Azure Stream analytics

I have created an Azure Stream Analytics (ASA) job to filter data based on a custom header property i send from a client app.
How would i read/filter message header properties in Azure stream analytics?
The portal return no results when i try to test out my query. Below is my query in azure portal.
So far this is my query as simple as this:
SELECT
*
INTO
[mystorage]
FROM
[iothubin]
WHERE Properties.type = "type1"
I also tried to call out the key without its parent (such as: where type = "") with no results as well.
I am sure that i am sending messages with this custom property in the header since i can view it using device explorer tool.
any idea how to get this working?
I haven't tried this yet myself, but supposedly you can access custom properties via GetMetadataPropertyValue(). Give this a try:
https://msdn.microsoft.com/en-us/library/azure/mt793845.aspx
You can use the query described here as an example to query complex schemas.
If you share your schema, we can look at the query for you.
Let me know if it works for you.
Thanks,
JS

Spree API - Create Product Variant with Initial stock quantity

I'm trying to create a Variant with amount of initial stock, via the API in an application.
Example URL:
--post http://localhost:3000/api/products/apache-baseball-Jersey/variants/
I found no way to do this. I tried to pass the parameters:
variant [amount], stock_item [count_on_hand], etc.
In the Spree documentation, to create the "stock_item," you need to do a new request on /api/stock_locations /1/stock_items. But I want to make just one request.
It is possible?
We can't send count_on_hand with one api request because we can manage our product stock on multiple locations so we need to manage this through one request per stock location that why it is required to send count_on_hand with another api request.

Resources