Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@odata properties missing #234

Open
M1kep opened this issue Mar 1, 2021 · 4 comments
Open

@odata properties missing #234

M1kep opened this issue Mar 1, 2021 · 4 comments
Assignees
Labels

Comments

@M1kep
Copy link

M1kep commented Mar 1, 2021

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

@ghost ghost added the ToTriage label Mar 1, 2021
@ghost ghost added this to Issues to triage in Graph SDK - Triage Mar 1, 2021
@nikithauc nikithauc self-assigned this Mar 1, 2021
@ghost ghost removed the ToTriage label Mar 1, 2021
@nikithauc nikithauc removed this from Issues to triage in Graph SDK - Triage Mar 1, 2021
@nikithauc
Copy link
Contributor

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.

@richban
Copy link

richban commented Jun 21, 2021

@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:

ss

can you elaborate why is this the case?

@richban
Copy link

richban commented Jun 21, 2021

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

@elliot-huffman
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants