Open M1kep opened 3 years ago
The msgraph-typescript-typings contains types representing the objects or entities and not the odata response. Please check the ReadMe for examples.
const res = await client.api(`/me/drive/root:/${ExcelFilename}:/workbook/worksheets`).get();
const worksheets = res.value as WorkbookWorksheet[];
const response = await client.api(`/me/`).get();
const user = response as User;
Please let me know if you have any more questions.
@nikithauc in my case using v1.0
version:
const appRoleAssignments = await client
.api(`/servicePrincipals/${SERVICE_PRINCIPAL_ID}/appRoleAssignedTo`)
.select("id")
.select("principalId")
.select("principalDisplayName")
.select("principalType")
.select("resourceId")
.select("resourceDisplayName")
.select("appRoleId")
.get()
return appRoleAssignments as AppRoleAssignment
I don't receive the AppROleAssignment
type but this:
can you elaborate why is this the case?
Alright I just noticed what's my actual response is :)
const client = getAuthenticatedClient(accessToken)
const response = await client
.api(`/servicePrincipals/${SERVICE_PRINCIPAL_ID}/appRoleAssignedTo`)
.select("id")
.select("principalId")
.select("principalDisplayName")
.select("principalType")
.select("resourceId")
.select("resourceDisplayName")
.select("appRoleId")
.get()
const appRoleAssignments = response.value as AppRoleAssignment[]
return appRoleAssignments
@nikithauc (bump) I have noticed that the readme doesn't appear to reference anything about odata, can a section be added back to the readme on how to remediate this situation or add the odata responses to the types? At the moment, I am bootlegging together the structures using union types.
I've recently started using these typing and am running into some issues as it appears none of the types/interfaces contains any of the
@odata.*
properties. The two I've ran into are@odata.context
and@odatda.type
AB#8340