Skip to content

Incorrect type for "Identity" in "IdentitySet" #116

Open

Description

The type Identity seems to be different from what the API is returning. This error occured for us when retrieving the identity of the creator of the document using the createdBy.user field on a DriveItem.

Expected (declared in microsoft-graph.d.ts line 8736)

{
  id?: string;
  displayName?: string;
}

Returned by API

{
  email: "some.email@domain",
  displayName: "Some Name"
}

We tried to switch to the beta types but they are the same.

We are for now casting the createdBy.user property to what the API is returning.
AB#7046

Activity

  1. MIchaelMainer commented on Feb 4, 2020

    @MIchaelMainer
    Contributor

    This is expected behavior per the metadata. This is an OpenType which means that undefined properties may be returned in this object. Additionally, id and displayName are nullable so it is expected that they may not be present in a response.

          <ComplexType Name="identity" OpenType="true">
            <Property Name="displayName" Type="Edm.String" />
            <Property Name="id" Type="Edm.String" />
          </ComplexType>

    Brad (@ificator) and Barry Shehadeh (@BarryShehadeh) It seems like the email property should be schematized.

  2. arthur-caillaud commented on Feb 5, 2020

    @arthur-caillaud
    Author

    Thank you for your answer. I was not clear but the issue is precisely about the email property being absent in the types and returned by the API. No problem with some properties being optional.

  3. mpsijm commented on Oct 26, 2020

    @mpsijm
    Contributor

    I also ran into this issue. Any updates on this?

  4. ificator commented on Oct 26, 2020

    @ificator

    I apologize, I somehow missed the previous notification from GitHub.

    So there are two questions:

    1. Why is id missing?
    2. Why is email a dynamic property instead of being present in the schema?

    For the former it will be useful to understand the scenario - was this a call against SharePoint or OneDrive Personal? what API was being invoked?

    For the latter - off the top of my head I don't see why this cannot be the case. There will be times when there is no email (e.g. if the identity represents a device) and so the value would be nullable but from that's essentially no different to todays state.

  5. mpsijm commented on Oct 26, 2020

    @mpsijm
    Contributor
    1. In my context, I'm using a SharePoint API. The exact same user sometimes has an id, sometimes doesn't. The email property from that same user seems to be there most of the time, but not always. See also the scenario I posted here: https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/4363.

    2. In the case that the identity represents a device, it would also make sense to me that the email is nullable. However, (a) it is currently not documented (neither in the typings nor in the docs) and (b) it seems to be not consistently set for regular users as in my previous point.

  6. ificator commented on Oct 31, 2020

    @ificator

    Any kind of inconsistency should be viewed as a bug so we'll investigate what's going on with the delta API. Are there any other APIs that you've noticed missing id values?

  7. mpsijm commented on Nov 1, 2020

    @mpsijm
    Contributor

    Not that I know of, at the moment. Is there a better place to report those inconsistencies than the typings or docs repositories? Then I can report back there if I can consistently reproduce missing values using the Graph Explorer.

  8. ificator commented on Nov 1, 2020

    @ificator

    For OneDrive / SharePoint API issues / questions the best place is https://github.com/OneDrive/OneDrive-api-docs. We generally only spot issues other repos when we're explicitly tagged.

  9. ificator commented on Nov 25, 2020

    @ificator

    Hi Maarten Sijm (@mpsijm) we recently pushed a change that should result in delta populating the id for identity objects that represent a user/group. Could you confirm that things are looking more consistent for you now?

  10. mpsijm commented on Nov 27, 2020

    @mpsijm
    Contributor

    Brad (@ificator) Yes, on first sight it looks like it's been fixed, thanks 😄 Still need to some more thorough testing, if I find anything weird I'll report back 🙂

    The email field now also seems to show up consistently in the response data (if the user has an email, of course), even though that field is still undocumented (see my second point in #116 (comment)).

  11. added
    ADO to GitHub automation label
    on Jan 11, 2021
  12. aigolang commented on Mar 13, 2023

    @aigolang

    Hello Maarten Sijm (@mpsijm) , could you please tell me how do you make the email and id of a user showing up consistently in the response CreatedBy filed.
    MS Graph API is GET /drives/{drive-id}/items/{item-id}
    For some users, the email and id are missing in the response.

    https://learn.microsoft.com/en-us/graph/api/resources/identity?view=graph-rest-1.0
    In some circumstances, the unique identifier for the actor might not be available. In this case, the displayName property for the identity will be returned, but the id property will be missing from the resource.
    What is the circumstance?

  13. mpsijm commented on Mar 13, 2023

    @mpsijm
    Contributor

    aigolang I did not do anything specific for this. The change in the API from #116 (comment) appeared to have fixed things, and we did not run into any issues since then. I still do not know under what circumstances some fields may be empty 😅

  14. added
    status:waiting-for-author-feedback
    and removed on May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ADO to GitHub automation labelservice issuestatus:waiting-for-author-feedback

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions