MS Graph API ... create Planner task including details/description using one single HTTP request? - microsoft-graph-api

I am using the Microsoft Graph API to create Planner tasks, and I am wondering if there is a way to create a task including task details/description using a single HTTP request.
This old question from 2018 is asking about the same thing. The outcome in 2018 was that several separate requests were necessary ... first creating the task, then getting and updating its details object, which is a somewhat cumbersome process.
The original answerer has recently updated their answer to say that this behavior has changed and "you can set task details fields in the same request as creating the task". However, I'm confused as to whether this applies to the REST API itself, or to the Microsoft SDKs (which I am not currently using, as I don't need most of their functionality).
When I make a POST request to the /planner/tasks endpoint, and supply the details object in the body like such ...
{
"planId": "(... plan ID ...)",
"bucketId": "(... bucket ID ...)",
"title": "Title for new task",
"details": {
"description": "Some description for new task"
},
"assignments": {
(... assignment data ...)
}
}
... the task is created, but I don't see any description/notes. This applies both to the "v1.0" and "beta" APIs. (I tried the newer "notes" property on the beta API as well, with the same result.)
Based on the MS docs I could not find a conclusive answer either.
Should a request such as the one I listed work right now? If yes, in which API version? If no, what am I missing?
Thanks!

That request should work, but there is an issue with the returned response to the create operation not including the task details. If you read the task details after the creation (or reading task expanding the details), the description should be there.

Related

Graph batch API throw error for update recurrent meeting with modifications

I created recurrent meeting with attendee in Office365 calendar.
Then updated one of occurrence - change subject for creating modifications.
I found Id of master event by graph-explorer and want to update subject.
For updating I used GraphAPI batch:
and as response I got error with code ErrorInternalServerError.
I use batch API because I need to update few events for one time.
After some manipulation I found that if for header Prefer add value as 'outlook.body-content-type='html'' instead 'outlook.body-content-type='text'' or remove it then batch API works correct:
I need to use value of Prefer as 'outlook.body-content-type='text'' because business requirements for text only.
Do you have any idea how to use batch API for my case and with my options?
UPD:
I tried to use update API without batching but also got the same error as for batch API update.
In header I used Prefer as 'outlook.body-content-type='text''
So looks like any update of recurrent event with modifications and header Prefer as 'outlook.body-content-type='text'' finished as InternalServerError

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);

Is it possible to set permissions on variable groups via the REST API?

I was curious if anyone knows how to set permissions (add/remove groups) to variable groups via the REST API. I know there is the security namespace, however it requires a resource guid and I am not sure how to get that for a specific variable group?
You want security namespace "Library" ( you need to convert it to proper namespace_id ) and with token "Library/$project_id/VariableGroup/$variable_group_id"
POST https://dev.azure.com/{organization}/_apis/accesscontrollists/{securityNamespaceId}?api-version=5.1
For ACL management REST API see https://learn.microsoft.com/en-us/rest/api/azure/devops/security/access%20control%20lists/set%20access%20control%20lists?view=azure-devops-rest-5.1
Example request:
"value": [
{
"inheritPermissions": true,
"token": "Library/$project_id/VariableGroup/$variable_group_id",
"acesDictionary": {
"Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-1": {
"descriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1204400969-2402986413-2179408616-0-0-0-0-1",
"allow": 31,
"deny": 0
}
}
}
]
Warning1 - At the moment the Microsoft doc on that topic is quite incomplete ( see, for example my comment on github issue asking for clarification of variables groups authentication mechanism ).
Warning2 - Be careful with ACL changing requests for ALL variable groups in project ( e.g. token=Library/$project_id/ ), because you might end up with removing permissions from all users on your Ado project and it's could be hard to change it back.
I am afraid it is not possible to set variable groups permission via api.
There is only group id we can get from variable group api below, no resource id in the response.
https://dev.azure.com/{organization}/{project}/_apis/distributedtask/variablegroups?api-version=5.1-preview.1
When i tried fetching the http request trace with F12 chrome. There is a value at the end of request url looks like the source id. And it is the project id combined with the variable group id. Donot know if this is resource guid you were looking for.
https://dev.azure.com//_apis/securityroles/scopes/distributedtask.variablegroup/roleassignments/resources/39e13f04-cb4e-4fa8-b2f1-0ee8f4fc82c5%241
I managed to reverse engineer who to do this. If anyone is curious on how it works feel free to talk a look at the powershell library for Azure DevOps I have put together -- https://github.com/ravensorb/Posh-AzureDevOps

Asana tag API query often misses newly created Tags

when we create projects via API the newly created project is immediately returned in both the webApp and in the API.
But a tag created using API "https://app.asana.com/api/1.0/tags" is often returned only after two or three GET requests. Also in the webApp it needs a refresh, online application sync does not update new tags like Projects.
This late returns really affects the user interaction. I follow the same workflow thats used for creating and adding project, but tags feels a bit laggy. Am I missing anything?
The answer is that tags which aren't associated with any tasks are - unfortunately - hidden in the app, and consequently also in the API. As you discovered, you can get the ID back from the POST to create and then associate it with a task from there (since there's little purpose in creating a tag if you're not associating it with something that shouldn't typically be a problem, but it is clunky). We are looking at changing our data model for tags to be a bit more intuitive in future, but that's still a ways off, so this is the reality for the foreseeable future.
the newly created tag is missed in the GET /tags API from time to time. But the http response returned after creation of the new tag by POST /tags, will contain the id, name and other properties of the newly created tag. So we can add the new tag from this response.
POST-> https://app.asana.com/api/1.0/tags \
-u "name=fluffy" \
-u "workspace=14916"
# Response
HTTP/1.1 201
{
"data": {
"id": 1771,
"name": "fluffy",
...
}
}

JIRA REST API issue transitions and worklog (v4.4.1)

Is it possible to update the worklog for an issue when transitioning (i.e. POST to /rest/api/latest/issue/{issueid}/transitions) via the REST API for JIRA (API version is 2.0.alpha1 of JIRA v4.4.1)? I'm posting a worklog as part of the request and looking for the minimum information I need to send (currently just minutesSpent and started time as these seem to be the only mandatory ones via the UI).
i.e.
worklog:
{
name: "worklog",
type: "worklog",
value: [
{
started: "2012-10-01T10:28:00.000+1000",
minutesSpent: 480
}
]
},
Currently the post to the URL seems to just ignore this additional data although the transition does take effect with a desired 204 response.
From the JIRA REST API Docs:
The fields that can be set on transtion, in either the fields parameter or the update parameter can be determined using the /rest/api/2/issue/{issueIdOrKey}/transitions?expand=transitions.fields resource. If a field is not configured to appear on the transition screen, then it will not be in the transition metadata, and a field validation error will occur if it is submitted.
If, in the response you get from the expansion, you don't see worklog, then I don't think it is possible.

Resources