Create Plan (BETA) doesn't seem to work - microsoft-graph-api

I'm trying to create a planner plan using Graph as per http://graph.microsoft.io/en-us/docs/api-reference/beta/api/user_post_plans
but I'm consistently getting the following BadRequest response:
"error": {
"code": "BadRequest",
"message": "Write requests are only supported on contained entities",
"innerError": {
"request-id": "eae08944-6f47-477e-9950-ade31c473dd7",
"date": "2016-03-07T11:59:04"
}
As per the docs I'm POSTing to https://graph.microsoft.com/beta/me/plans with the following body:
"createdBy": "<my uuid>",
"owner": "<a previously generated group uuid>",
"title": "Blah Plan"
with no luck. The previously generated group looks like the following:
{
"id": "<uuid>",
"classification": null,
"createdDateTime": "2016-03-07T09:53:26Z",
"description": "Int Test",
"displayName": "Int Test",
"groupTypes": [
"Unified"
],
"mail": "<email_address>",
"mailEnabled": true,
"mailNickname": "IntTest",
"onPremisesLastSyncDateTime": null,
"onPremisesSecurityIdentifier": null,
"onPremisesSyncEnabled": null,
"proxyAddresses": [
"SMTP:<email_address>"
],
"renewedDateTime": "2016-03-07T09:53:26Z",
"securityEnabled": false,
"visibility": "Public"
}
I've tried various combinations of request bodies. With and without createdBy values. With and without owner values. Nothing seems to work.
Any ideas where I'm going wrong? The error is consistent across my integration tests as well as through the graph explorer.
Thanks

As Sriram mentioned, this was a documentation bug. It has just been fixed. The updated URL is: https://graph.microsoft.io/en-us/docs/api-reference/beta/api/plan_post_plans
The issue was in which endpoint to call to create a plan. You should call "/plans" instead of "/me/plans". You should also be aware that some of the data you are passing in is read-only. You should not include "createdBy" because this is a read-only property set by the service, not you. The plan resource documentation will show you all of the properties that can be set on a plan.
The last thing to keep in mind is that you can only have one plan per group. If you try to make a second plan, you'll receive an error about this from the API.

In Juli 2017 the API was modified and released. The new endpoint for creating a plan now is:
https://graph.microsoft.com/v1.0/planner/plans
with a request body e.g. like this:
{
"owner": "<group-id>",
"title": "my plan title"
}
where <group-id> must be the id of a previously created group.

Apologies for the confusion here. The documentation has a bug will be updated shortly. To create a plan, please ensure that a group is created, and the user is member of group. Then create the plan with owner set to group id, and createdBy set to user id.

For this issue, can you please try following the below steps exactly?
Create a unified group
Add user to be member of unified group
Create plan by sending {“owner”: group-id, “title”: string} - do not send "createdBy" field since it's a read-only field
For adding tasks to buckets, it should work just fine if you sent
{“planId”: plan-id, “bucketId”: bucket-id, “title”: string}
If this still doesn't work, feel free to reach out to me at lixian#microsoft.com.
Thanks,
Sean

Related

MS Team[BETA] API for Message object property type for reaction

I am trying to create the schema for Message API
As per the documentation, the sample response properties for reaction provided are below
Documentation sample response
"reactions": [
{
"reactionType": "like",
"createdDateTime": "2019-01-21T19:55:51.893Z",
"user": {
"application": null,
"device": null,
"conversation": null,
"user": {
"id": "e1ecb745-c10f-40af-a9d4-cab946c80ac7",
"displayName": null,
"userIdentityType": "aadUser"
}
}
}
]
From the documentation user is Identity type identity set
Identity is of type:
{
"displayName": "string",
"id": "string",
"tenantId": "string",
"thumbnails": { "#odata.type": "microsoft.graph.thumbnailSet" }
}
From the sample response as well as the response from endpoint, tenantId is not present.
There is a difference in sample response/actual endpoint response and documented properties:
The one with tenantId or one without tenantId.
The user is 1 level as per property documentation but as per actual response and sample response user property has user with in.
What is the correct schema of reaction property that we should consider, because we see variation in documentation vs actual response ?
ok, I think I understand - you're just asking what you should be coding for / expecting, when you query the api. It looks to me like the first link you've posted is the more correct, but you can verify this by using the Graph Explorer. This response does NOT bring back "tenantId", but you haven't explained if you -need- tenantId. If so, there are other ways to get it.
#KritikaVohra, Consider the response that you receive from the https://graph.microsoft.com/beta/teams/{id}/channels/{id}/messages. You don't need tenant id here. in case in conversation if you need it, you can use it from turnContext.

Bitbucket API: Add default reviewers using usernames

On-prem server Bitbucket 6.10.
Referring to the API for adding default reviewers for a project.
POST Request:
https://git.company.net/rest/default-reviewers/1.0/projects/test-project/condition
Body:
{"sourceMatcher":{"id":"any","type":{"id":"ANY_REF"}}, "targetMatcher":{"id":"any","type":{"id":"ANY_REF"}}, "reviewers":[{"name": "p950a", "slug": "p950a", "id": 56111},{"name": "p950h", "slug": "p950h", "id": 45222}], "requiredApprovals":"0"}
It seems it's mandatory to pass "id" for each reviewer - "slug", "name" don't seem to work. I get the following error if "id" is excluded.
{
"errors": [
{
"context": null,
"message": "No user exists for identifier -1.",
"exceptionName": "com.atlassian.bitbucket.validation.ArgumentValidationException"
}
]
}
It's quite inefficient and tedious to retrieve IDs for several users, store them and then again iterate over that list to pass here. Is there a better way to do this or am I missing something?

How to differentiate between Students and Teachers?

In the Microsoft Teams client SDK there is a userLicenseType property which we can use to determine if the user is a student or a teacher.
We want to do the same thing in our backend code to make sure that Students aren't running processes they shouldn't be, but we can't find an easy way of getting this same information from Microsoft Graph.
Does anyone know a way we can find this information? We were hoping it might be available through the access token or through /v1.0/education/me/ or /v1.0/me/ endpoints.
The educationUser has a similar property called primaryRole. You can retrieve this using /v1.0/education/me. Here is an example result:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#education/me/$entity",
"accountEnabled": true,
"displayName": "Megan Bowen",
"givenName": "Megan",
"surname": "Bowen",
"userPrincipalName": "MeganB#M365x214355.onmicrosoft.com",
"userType": "Member",
"id": "48d31887-5fad-4d73-a9f5-3c356e68a038",
"primaryRole": "teacher"
}

Using filter on /me/joinedTeams not working

I'm implementing a search for a user's joined Teams unsing Microsoft Graph. The idea is to make a call to /beta/me/joinedTeams and use a ?$filter=startswith(description,'searchterm') filter.
So for example when I try the request https://graph.microsoft.com/beta/me/joinedTeams?$filter=startswith(description,'Business') in the Microsoft Graph Explorer it ignores the filter and I get these results:
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#groups",
"value": [
{
"id": "02bd9fd6-8f93-4758-87c3-1fb73740a315",
"displayName": "HR Taskforce",
"description": "Welcome to the HR Taskforce team.",
"isArchived": false
},
{
"id": "13be6971-79db-4f33-9d41-b25589ca25af",
"displayName": "Business Development",
"description": "Welcome to the BizDev team.",
"isArchived": false
},
{
"id": "8090c93e-ba7c-433e-9f39-08c7ba07c0b3",
"displayName": "X1050 Launch Team",
"description": "Welcome to the team that we've assembled to launch our product.",
"isArchived": false
}
]
}
Am I doing something wrong with my request?
Your request is right, but the joinedTeams does not support filtering or ordering results. So although we pass the filter/orderby parameter, when Microsoft Graph sees a query parameter it doesn't expect, it simply ignores the unknown filter/orderby parameter and returns an unfiltered/default-sorted result.
I have tried the api with odata query parameters for trial O365 account and real account.
https://developer.microsoft.com/en-us/graph/docs/concepts/query_parameters
Not all parameters are supported across all Microsoft Graph APIs, and
support might differ significantly between the v1.0 and beta
endpoints.
The only suggestion for you is to vote up the existing feature request in User Voice or submit a new one.
Thanks for pointing this out. As Seiya points out, /me/joinedTeams does not support the OData query parameters. The documentation suggested otherwise, I've made a doc fix that should propagate in the next day or two.

Course Files Folder not being created

I am creating courses using the Valence API.
In DOME we have the d2lTools.CMS.CoursePathEnforced variable set to on.
According to the documentation:
Path:
The root path to use for this course offering’s course content. Note that, if your >>back-end service has path enforcement set on for new org units, then you should leave >>this property as an empty string, and the back-end service can populate it for you.
So I am setting the path property to an empty string when I create the course.
However, the folder is never created for the course path, so when users try to add content to a course they get an error. I can't set the path manually because it requires the Org Unit ID of the course, which I don't know till it's created.
Is this a bug or do I have something not configured properly?
Cheers, Iain
Here is a sample of the JSON structure you should send (note that the CourseTemplateId and SemesterId properties refer to the D2LID values for the course template and semester your new course derives from):
{"LocaleId": null,
"CourseTemplateId": 1234,
"Name": "Extensibility 105",
"ShowAddressBook": false,
"ForceLocale": false,
"StartDate": null,
"EndDate": null,
"Path": "",
"SemesterId": 5678,
"Code": "EXT-105"}
The create call sends back JSON upon successful creation that looks like this:
{"Name": "Extensibility 105",
"StartDate": null,
"CourseTemplate": {"Name": "ExtensibilityTemplate",
"Code": "EXT-TMPL",
"Identifier": "1234"},
"EndDate": null,
"Path": "/content/enforced/7531-EXT-105/",
"IsActive": true,
"Semester": {"Name": "Spring 2013",
"Code": "S2013",
"Identifier": "5678"},
"Code": "EXT-105",
"Department": {"Name": "ExtensibilityDepartment",
"Code": "1",
"Identifier": "2468"},
"Identifier": "7531"}
Note that the call allocated an Identifier property for the new course, and then incorporated that identity into the enforced content Path as one would expect.

Resources