Error in getting topic title in D2L - desire2learn

So I am trying to get the quiz names from course in D2L using this API GET /d2l/api/le/(version)/(orgUnitId)/content/topics/(topicId) http://docs.valence.desire2learn.com/res/content.html#get--d2l-api-le-(version)-(orgUnitId)-content-topics-(topicId)
But I am response which has wrong topic 'Title' field.
GET /d2l/api/le/1.4/6671/content/topics/1134
Response:
{
"DueDate": null,
"TopicType": 3,
"Url": "/d2l/common/dialogs/quickLink/quickLink.d2l?ou=66xx&type=quiz&rCode=1A4DE57C-F-3xx",
"StartDate": null,
"EndDate": null,
"IsHidden": false,
"IsLocked": false,
"Id": 1134,
"Title": "/d2l/common/dialogs/quickLink/quickLink.d2l?ou={orgUnitId}&type=quiz&rCode=1A4DE57C-F-3xx",
"ShortTitle": "",
"Type": 1
}
I created this quiz directly from course module --> new --> new quiz. But If I create quiz from Quizzes (Top menu) --> Manage Quiz --> New quiz. Then I get correct Title. Do I need to add some settings in quiz to get correct Title? Is there better way to get names?
We are running v10.3 of LMS

Unfortunately, this is a known issue, and will be addressed with due priority but D2L currently does not have an expected timeline for fixing it. If you'd like to track the status of this issue, or lobby for an increased priority on this issue, D2L encourages you to do so via your account or partner manager, or approved support contact.

Related

How to get OneNote Notebook/Section/Page Id from Teams Tab

I have embedded a OneNote notebook into a Microsoft Teams Tab. I am trying to get the Notebook Id using Graphi API
I can get the tab id from channels/{{ChannelId}}/messages/delta end point.
Using tabId, I can get tab details from channels/{{ChannelId}}/tabs/{{tabid}} end point.
Tab details end point gives configuration details that has contentUrl and websiteURL.
{
"id": "tabId",
"displayName": "My Contoso Tab - updated",
"configuration": {
"entityId": "2DCA2E6C7A10415CAF6B8AB6661B3154",
"contentUrl": "",
"websiteUrl": "",
"removeUrl": ""
},
"teamsApp": {
"id": "0d820ecd-def2-4297-adad-78056cde7c78",
"externalId": null,
"displayName": "Contoso",
"distributionMethod": "store"
},
"sortOrderIndex": "20",
"webUrl": ""
}
How can I get notebook Id or Section Id or Page Id that is embedded into the tab?
Formally the OneNote tab explicitly has no public documentation regarding its configuration as per :
https://learn.microsoft.com/en-us/graph/teams-configuring-builtin-tabs#onenote-tabs.
You can indeed try to reverse engineer the content or web URLs, and you may very well succeed today.
But you need to understand , and accept responsibility and the associated integration testing potential downtime as that URL format can/will change with no notification whatsoever.
If you can accept that risk & responsibility, using the oneNoteWebUrl= QSP from the contentUrl json node seems to be a decent key.
"configuration": {
"entityId": "00727f3d-df18-43ac-8cc9-698774312f5e",
"contentUrl": "https://www.onenote.com/teams/TabContent?notebookSource=Pick&notebookSelfUrl=https%3A%2F%2Fwww.onenote.com%2Fapi%2Fv1.0%2FmyOrganization%2Fgroups%0076777f1c-3e3d-44ad-8206-53ba08a44cec%2Fnotes%2Fnotebooks%007-ce5c7935-0960-41f0-a5ce-e82a6d365f45&oneNoteWebUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook&notebookName=TaaP%20Notebook&siteUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP&createdTeamType=Standard&oneNoteClientUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook&notebookIsDefault=true&ui={locale}&tenantId={tid}&upn={userPrincipalName}&groupId={groupId}&theme={theme}&entityId={entityId}&subEntityId={subEntityId}&sessionId={sessionId}&ringId={ringId}&teamSiteUrl={teamSiteUrl}&channelType={channelType}&trackingId={appSessionId}&hostClientType={hostClientType}",
"removeUrl": "https://www.onenote.com/teams/TabRemove?notebookSource=Pick&notebookSelfUrl=https%3A%2F%2Fwww.onenote.com%2Fapi%2Fv1.0%2FmyOrganization%2Fgroups%2F46777f1c-3e3d-44ad-8206-53ba08a44cec%2Fnotes%2Fnotebooks%2F1-ce5c7935-0960-41f0-a5ce-e82a6d365f45&oneNoteWebUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook&notebookName=TaaP%20Notebook&siteUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP&createdTeamType=Standard&oneNoteClientUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook&notebookIsDefault=true&ui={locale}&tenantId={tid}&upn={userPrincipalName}&groupId={groupId}&theme={theme}&entityId={entityId}&subEntityId={subEntityId}&sessionId={sessionId}&ringId={ringId}&teamSiteUrl={teamSiteUrl}&channelType={channelType}&trackingId={appSessionId}&hostClientType={hostClientType}",
"websiteUrl": "https://www.onenote.com/teams/TabRedirect?redirectUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook",
--> `oneNoteWebUrl=https%3A%2F%2Fm365x432007.sharepoint.com%2Fsites%2FTaaP%2FSiteAssets%2FTaaP%2520Notebook'
--> urldecode
https://m365x432007.sharepoint.com/sites/TaaP/SiteAssets/TaaP%20Notebook
The response of channels/{{ChannelId}}/tabs/{{tabid}} will contain details for tab and will not return details for the embedded onenote notebooks and pages. However you can get details for onenote notebooks and pages using https://graph.microsoft.com/v1.0/me/onenote/notebooks
You can refer below document for more information
https://learn.microsoft.com/en-us/graph/integrate-with-onenote
https://learn.microsoft.com/en-us/graph/api/resources/onenote-api-overview?view=graph-rest-1.0
Thanks

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"
}

ErrorItemNotFound when trying to retrieve room calendar via MS Graph API

Next to retrieving calendar views of a user's calendar (on behalf of the user), we are trying hard to also get the calendar view of rooms via the Graph API using
https://graph.microsoft.com/beta/users/room1#ourdomain.com/calendarView. It's a painful process since we've been running into many problems and are currently stuck with the following 404 response:
https://graph.microsoft.com:443/v1.0/users/room1#ourdomain.com/calendarView?startDateTime=2018-12-04T23:00:00.000Z&endDateTime=2019-02-10T22:59:59.999Z
{
"error": {
"code": "ErrorItemNotFound",
"message": "The specified object was not found in the store.",
"innerError": {
"request-id": "358a003a-57a4-4f0e-91da-edc17c1fa2d8",
"date": "2018-12-12T07:38:33"
}
}
}
The email address of the room has been double checked and the resource exists, since we can create appointments with it and it is even being returned in the response when we retrieve the calendar of the user who has an appointment in that location.
App permissions and OAuth2 scopes are set to: openid email profile offline_access https://graph.microsoft.com/Calendars.Read https://graph.microsoft.com/Calendars.Read.Shared https://graph.microsoft.com/User.Read
https://graph.microsoft.com/User.ReadBasic.All https://graph.microsoft.com/User.Read.All, so that should not be an issue, judging by the documentation.
Does anyone know how to solve this?
I've tried all possible ways, but there is no way to get access.
This is what I've tried out the following in the Graph explorer:
https://graph.microsoft.com/v1.0/users/meetingroom1#domain.com/events -> DelegatedCalendarAccessDenied
https://graph.microsoft.com/v1.0/users/meetingroom1#domain.com/calendarView?startDateTime=2019-01-14&endDateTime=2019-01-18 -> ErrorItemNotFound
https://graph.microsoft.com/v1.0/users/meetingroom1#domain.com/calendar/calendarView?startDateTime=2019-01-14&endDateTime=2019-01-18 -> ErrorItemNotFound
All three on both the v1.0 and the beta.
It isn't an issue with rights, because for my testing I granted the Graph Explorer the Directory.ReadWrite.All scope. Resulting in the following scp claim.
The first requests seems the most promising (because of the different error), I also made myself a delegate with full control of the rooms-mailbox. That still didn't help.
A request to https://graph.microsoft.com/v1.0/users/meetingroom1#domain.com gives a result, as in a result describing the meetingroom.
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
"businessPhones": [],
"displayName": "Meeting room 1",
"givenName": null,
"jobTitle": null,
"mail": "meetingroom1#domain.com",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "meetingroom1#domain.com",
"id": "3e0a7b7e-xxxx-xxxx-xxxx-xxxxcxxxx120"
}
After doing all these tests, I can only conclude that you cannot access the events in a rooms mailbox. This is either intended (as in only use the scheduling assistant) or a bug.
Maybe some of the Microsoft guys around here could clarify this?
FINALLY! After going through this with countless Microsoft support people, each of whom said this was not their territory and did not know where to forward the question, I got in touch with somebody from the Exchange team. He suggested the one thing that worked for us: the user on behalf of which you are retrieving the room resource calendar needs to be a delegate of that room resource!
In addition, to retrieve the list of room resources which the user can select from, we needed to use the findRooms endpoint but this only works on the beta API. The only drawback of this is that you cannot seem to filter for rooms of which the user is a delegate. So the user will get a list of rooms for which he might or might not be able to retrieve the calendar.
A final drawback of the room resource calendarView response is that the response does not contain the names of the meetings planned in the rooms. The description of each event only contains the name of the meeting organizer.

Create Plan (BETA) doesn't seem to work

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

Rails: How to disable app after certain amount of usage

I have a Rails/Shopify app that processes orders from the User's Shopify store. I want to have tiered plans (e.g. Bronze < 20 orders, Silver < 100 orders, Gold 100+).
What's the best way to implement this?
1) How do I track which subscription plan they are on, when it changes etc?
2) How do I disable the app once a user hits their limit?
Any links to articles/tutorials/gems to help would be great.
I would do it the following way. Once you have the token you can access the application charges for the shop you're in. You could either use
GET /admin/recurring_application_charges/455696195.json
or like I use it
ShopifyAPI::RecurringApplicationCharges.current
which gets you the current plan the user is on. You can access the name of the plan etc. To track how many orders were processed I would write a controller and implement a simple counter. Each time a request is being sent the counter is incremented. Once the limit is reached you can redirect him to an error page or somewhere else.
To answer the second part of your question you could access the current charge as mentioned above and get all the information you need (e.g. "billing_on": "2015-03-27T00:00:00+00:00")
Here is a sample response with all the available fields:
HTTP/1.1 200 OK
{
"recurring_application_charge": {
"activated_on": null,
"api_client_id": 755357713,
"billing_on": "2015-03-27T00:00:00+00:00",
"cancelled_on": null,
"created_at": "2015-03-28T13:31:19-04:00",
"id": 455696195,
"name": "Super Mega Plan",
"price": "15.00",
"return_url": "http:\/\/yourapp.com",
"status": "pending",
"test": null,
"trial_days": 0,
"trial_ends_on": null,
"updated_at": "2015-03-28T13:31:19-04:00",
"decorated_return_url": "http:\/\/yourapp.com?charge_id=455696195",
"confirmation_url": "https:\/\/apple.myshopify.com\/admin\/charges\/455696195\/confirm_recurring_application_charge?signature=BAhpBENfKRs%3D--a911ece9470850c96f6c7735c684b8a3f6869594"
}
}
You can find more under https://docs.shopify.com/api/recurringapplicationcharge or https://docs.shopify.com/api/applicationcharge
Hope I could help

Resources