Assignment screen disabled for Teams created via Microsoft Graph - json

When I create a Team (they are of the type Class for Teachers and Students) using the Microsoft Graph Education APIs, the Team appears in the Microsoft Teams app and the Assignment tab is visible.
When I try to create a new assignment in the Teams app, the screen for creating an assignment is disabled, so it's not possible to create new assignments for any Team created via the API.
Am I doing something wrong?
Team created through the API (controls are disabled, no save and delete controls):
Teams created through the Teams app (controls are enabled):
Workflow:
I create a Team via POST https://graph.microsoft.com/V1.0/education/classes
with the body of:
{
"displayName": "Test2",
"description": "Test2",
"classCode": "Test2",
"externalId": "2",
"externalName": "Test2",
"externalSource": "sis",
"mailNickName": "Test2_2",
"term": {
"displayName": "Term2",
"externalID": "2",
"startDate": "2017-09-01",
"endDate": "2019-08-31"
}
}
(also tried with "externalSource":"manual")
Add a Teacher using POST https://graph.microsoft.com/V1.0/education/classes/{id}/teachers/$ref with a body of
{
"#odata.id": "https://graph.microsoft.com/V1.0/education/users/{id}"
}
Add a Student using POST https://graph.microsoft.com/V1.0/education/classes/{id}/members/$ref with a body of:
{
"#odata.id": "https://graph.microsoft.com/V1.0/education/users/{id}"
}
All of these calls are successful and the Team shows up in the Teams app. The Assignment tab also shows up, so the Team is an Education Team.

This was a known bug - the fix was deployed on 9/3/2018.

Related

London AvailabilityDomain could not be inferred from the Request

I am pretty sure this is something trivial, but I am a bit stuck with this.
I am trying to create an instance in Oracle Cloud in uk-london-1 region via OCI CLI tool.
I am getting
"code": "InvalidParameter",
"message": "AvailabilityDomain could not be inferred from the Request",
The command I am trying to use:
oci compute instance launch --availability-domain lMrS:UK-LONDON-1-AD-1 --compartment-id <myid> --shape VM.Standard.E2.1.Micro --subnet-id <subnetid> --image-id Canonical-Ubuntu-22.04-2022.06.16-0
I got the list of AD's via CLI
~$ oci iam availability-domain list
{
"data": [
{
"compartment-id": "ocid1.tenancy.oc1..###",
"id": "ocid1.availabilitydomain.oc1..###",
"name": "lMrS:UK-LONDON-1-AD-1"
},
{
"compartment-id": "ocid1.tenancy.oc1..###",
"id": "ocid1.availabilitydomain.oc1..###",
"name": "lMrS:UK-LONDON-1-AD-2"
},
{
"compartment-id": "ocid1.tenancy.oc1..###",
"id": "ocid1.availabilitydomain.oc1..###",
"name": "lMrS:UK-LONDON-1-AD-3"
}
]
}
And it is the same list of AD names I see in the Web UI.
Also I have similar error when trying to follow Oracle Cloud "Terraform: Create a Compute Instance" tutorial.
Any help will be appreciated!
Thanks to #urawesome, my compartment-id was wrong and the error returned is a bit misleading as well.
I used actual Compartment name from web UI, when it should have been ocid1.tenancy.### Mainly focused on availability-domain thinking that other parameters will throw different errors if they are invalid.
Correct compartment-id aka tenancy-id solved the issue.
Thanks!

Microsoft Teams cards as html

I have Microsoft Teams chat messages collected via API and want to display those on a website. The problem comes when JSONs of cards are in these chat messages. I tried displaying adaptive cards with Adaptive Card JS SDK and it displayed adaptive card type fine. But I can't find any reference to how can I display other card types correctly.
Few thoughts:
Can I convert any other card type to an Adaptive Card JSON (either
by a library or coding the con so I can display with Adaptive Card
JS SDK? But then if I do it by code myself will I able to handle all
card types/scenarios?
Is there any JS library that could show JSONs of cards other than
Adaptive cards also
I need to be able to display any card type, but it doesn't need to be an exact match of how displayed in the MS Teams app (closer the better :) ). I don't need any functionalities in cards as button clicks/redirections, just card need to be rendered in HTML as it would in MS Teams.
Note: I have the content types of card JSON as application/vnd.microsoft.card.hero, application/vnd.microsoft.card.thumbnail, application/vnd.microsoft.teams.card.o365connector, etc from chat meta data.
eg 1: Card from Wikipedia app
JSON for the card
{
"title": "Unidentified flying object",
"text": "unidentified flying object (<span>UFO</span>) is any aerial phenomenon that cannot immediately be identified or explained. Most <span>UFOs</span> are identified or investigated",
"images": [
{
"alt": "Unidentified flying object",
"url": "https://upload.wikimedia.org/wikipedia/commons/b/bc/PurportedUFO2cropped.jpg"
}
],
"buttons": [
]
}
eg 2: Card of Stocks app
JSON for the card
{
"sections": [
{
"activityTitle": "<span style=\"font-weight:600;font-size:1.8rem\">Apple Inc (Nasdaq Stock Market: AAPL)</span>",
"activitySubtitle": "<span style=\"font-size:1.6rem\">125.89 <span style=\"color:#7FBA00\">▲ 2.35 (1.90%)</span></span>",
"activityText": "\r\n<br/>\r\n<div style=\"font-size:1.2rem\">\r\n <p>\r\n <span style=\"font-weight:600\">When:</span> Friday, June 4, 2021 7:59 PM EDT. Delayed 15 minutes.<br/> <span style=\"font-weight:600\">After hours:</span> 126.01\r\n </p>\r\n <p>Data from Refinitiv</p>\r\n</div>",
"potentialAction": [
{
"#type": "OpenUri",
"targets": [
{
"os": "default",
"uri": "https://www.msn.com/en-us/money/stockdetails/fi-a1mou2"
}
],
"name": "More details",
"#id": "ViewOnMsn"
},
{
"#type": "OpenUri",
"targets": [
{
"os": "default",
"uri": "https://www.bing.com/news/search?q=Apple Inc"
}
],
"name": "News",
"#id": "ViewNews"
}
],
"markdown": false
}
]
}
eg 3: Card of Youtube app
JSON for the card
{
"title": "M1 MacBook Pro and Air review: Apple delivers",
"subtitle": "The Verge | 1.4M views | 6 months ago",
"text": "<p>Apple has updated three Mac with its own M1 processors: the Macbook Air, the entry-level 13-inch MacBook Pro, and the Mac mini. Will Intel-based apps run? Will ...</p>\r\n\r\n\r\n<p>YouTube | 12:57</p>",
"images": [
{
"alt": "M1 MacBook Pro and Air review: Apple delivers",
"url": "https://i.ytimg.com/vi/OEaKQ0pxQsg/hqdefault.jpg"
}
],
"buttons": [
],
"tap": {
"type": "openUrl",
"title": "M1 MacBook Pro and Air review: Apple delivers",
"value": "https://www.youtube.com/watch?v=OEaKQ0pxQsg"
}
}
Can I convert any other card type to an Adaptive Card JSON (either by a library or coding the con so I can display with Adaptive Card JS SDK? But then if I do it by code myself will I able to handle all card types/scenarios?
Bot Framework Web Chat renders all Bot Framework rich cards by converting them into Adaptive Cards first. Web Chat is open source, so you can have a look at the source code to see how it does that. However, the sample card you've shown from the Stocks app is a Teams-specific O365 Connector card and not a Bot Framework card, and the Teams source code is proprietary so you will not easily find out how that JSON gets processed. You can refer to the Teams docs to get an idea of the range of card types you're likely to encounter.
Is there any JS library that could show JSONs of cards other than Adaptive cards also
No, there is not. You might consider opening the Teams web app in your browser so you can read the HTML of the conversations you've collected from your API and compare the HTML to the JSON. You might also consider using a tool to just copy the HTML from your conversations directly instead of using the API to get the conversations in JSON form.

Integration from CRM to Team Foundation Server 2018

We have CRM where customers create tickets (change requests, incidents...).
From developer team side we have Team Foundation Server 2018.
To speed up process we would like to automatize entire thing. So, when customer create ticket, to automatic create TFS User Story.
We developed code to take, every time when ticket is created, data and put into JSON file. (will attach code in Github and share a link)
But now, I just need info, is someone have an idea, how JSON file should looks like which need to post to TFS in order to create new user story.
{
"fields": {
"System.WorkItemType": "User Story",
"System.AreaPath": "EJ2TFS",
"System.TeamProject": "EJ2TFS",
"System.IterationPath": "EJ2TFS",
"System.State": "New",
"System.Reason": "New",
"Microsoft.VSTS.Common.StateChangeDate": "2019-01-01T00:00:00Z",
"System.ChangedBy": "Doe, John <firm\\doej>",
"System.CreatedBy": "Doe, John <firm\\doej>",
"System.Title": "Sample task created by POST API",
"System.Discussion":"test1",
"Microsoft.VSTS.Common.StateChangeDate": "2019-01-31T14:00:00",
"Microsoft.VSTS.Common.Priority": 2,
"Microsoft.VSTS.Common.ValueArea": "Business"
}
}
And error is:
{
"$id": "1",
"innerException": null,
"message": "The request indicated a Content-Type of \"text/plain\" for method type \"POST\" which is not supported. Valid content types for this method are: application/json-patch+json.",
"typeName": "Microsoft.VisualStudio.Services.WebApi.VssRequestContentTypeNotSupportedException, Microsoft.VisualStudio.Services.WebApi",
"typeKey": "VssRequestContentTypeNotSupportedException",
"errorCode": 0,
"eventId": 3000
}
Looks like your payload need a makeover. I referred couple of code samples & sharing this snippet. (Pls test this, I didn’t get a chance to test it)
POST https://dev.azure.com/fabrikam/{project}/_apis/wit/workitems/$User Story?api-version=5.0
[
{
"op": "add",
"path": "/fields/System.Title",
"from": null,
"value": "My first user story"
}
]
MS documentation example
GitHub sample

Microsoft Graph does not retrieve the Group's Plan Id

After creating a Group using POST /v1.0/groups with the body:
{
"description": "hello",
"displayName": "group_for_restore",
"groupTypes": [
"Unified"
],
"mailEnabled": true,
"mailNickname": "group_for_restore",
"securityEnabled": false,
"visibility": "Public"
}
A request to GET /v1.0/groups/{group-id}/planner/plans does not retrieve any plans.
As far as I know, after creating a Group, a Plan will be created too. On the web interface you can see that this plan is correctly created and shown, but it does not appear in JSON response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.plannerPlan)",
"#odata.count": 0,
"value": []
}
After clicking on it in the web interface you can easily get the plan using the request above.
Is it ok to do such magic steps to fetch plan id?
The Web App is provisioning the Group's Plan the first time you attempt to access it. When creating a Group through the API however, you'll need to create a new Plan yourself:
POST https://graph.microsoft.com/v1.0/planner/plans
Content-type: application/json
{
"owner": "group-id",
"title": "title-value"
}
Keep in mind this important note from the documentation:
When creating a new plan, make a group its owner by simply setting the owner property on a plan object.

branch.io rest API for bulk link creation doesn't preserver order of request

We use POST /v1/url/bulk/:branch_key for batch deep link generation for some of our items.
The response returns an array of URL's alone. The links are working fine, but its not returned in the order of our items send as request.
Is there any way to identify which branch link belongs to which item?
At least if the response had item's id or some other custom data returned with it, we could identify the link correctly.
Any hope? Thanks.
At the most basic level, this information is available to you via the Links tab on the Branch dashboard's Liveview & Export page. You can see the last 100 links created on this tab. To see more, you can use the "Export Links" button that appears in the upper right hand corner of the page.
If you need this for more information than can be retrieved via "Export Links," you can have the app whitelisted for the Data Export API (see: https://dev.branch.io/methods-endpoints/data-export-api/guide/). This provides access to a daily collection of .csv files that would include links created and their metadata. To whitelist the app for the Data Export API you send a request to integrations#branch.io. Be sure to include the app's key and to send the request from an email address on the Team tab (https://dashboard.branch.io/settings/team).
You can also query links. For a single link, append "?debug=true" and enter this value into the address bar of your browser.
You can also script the lookup of link data using the HTTP API: https://github.com/BranchMetrics/branch-deep-linking-public-api#viewing-state-of-existing-deep-linking-urls
The Branch API also allows you to specify a custom alias (the URL slug), so if you simply want an easy way to tie specific bulk-created URLs to the data inside without querying a second time, you could use this as a workaround. Details here
The bulk creation link API would return the links in that specific order.
You can test out the same via creating 3 links and using a particular parameter to differentiate.
E.G :
curl -XPOST https://api2.branch.io/v1/url/bulk/key_live_xxxxxxxxxxx -H "Content-Type: application/json" \
-d '[
{
"channel": "facebook",
"feature": "onboarding",
"campaign": "new product",
"stage": "new user",
"tags": ["one", "two", "three"],
"data": {
"$canonical_identifier": "content/123",
"$og_title": "Title1",
"$og_description": "Description from Deep Link",
"$og_image_url": "http://www.lorempixel.com/400/400/",
"$desktop_url": "http://www.example.com",
"custom_boolean": true,
"custom_integer": 1243,
"custom_string": "everything",
"custom_array": [1,2,3,4,5,6],
"custom_object": { "random": "dictionary" }
}
},
{
"channel": "facebook",
"feature": "onboarding",
"campaign": "new product",
"stage": "new user",
"tags": ["one", "two", "three"],
"data": {
"$canonical_identifier": "content/123",
"$og_title": "Title2",
"$og_description": "Description from Deep Link",
"$og_image_url": "http://www.lorempixel.com/400/400/",
"$desktop_url": "http://www.example.com"
}
},
{
"channel": "facebook",
"feature": "onboarding",
"campaign": "new product",
"stage": "new user",
"tags": ["one", "two", "three"],
"data": {
"$canonical_identifier": "content/123",
"$og_title": "Title3",
"$og_description": "Description from Deep Link",
"$og_image_url": "http://www.lorempixel.com/400/400/",
"$desktop_url": "http://www.example.com"
}
}
]'
As you can see, we have used og_title as a unique parameter and the links created for your app would be in the same order.
Yes, You can identify link belongs to which item by using data of branch.io link , you can pass branch.io config parameter as well as your custom parameters.
Every Branch link includes a dictionary of key : value pairs that is specified by you at the time the link is created. Branch’s SDKs make this data available within your app whenever the app is opened via a Branch link click.