pnp / pnp/pnpframework

Graph.UserUtility getting users runs into an error when adding Id to selectedProperties

Open
#688 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
259
Forks
161
Avg merge
10h 33m
Merged PRs (30d)
1

Description

The ListUsers and ListUserDelta functions in the PnP.Framework.Graph.UsersUtility are running into the following issue when the selectedProperties include "Id".

Object of type 'System.String' cannot be converted to type 'System.Nullable`1[System.Guid]'.

This seems to be the case because of the MapUserEntity function trying to re-set the Id property if it is part of the selectedProperties without converting it to a Guid as required by the model.

The workaround is simply removing "Id" from selectedProperties when calling the function as Id is returned by default, but maybe the function should catch this as well.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in PnP.Framework.Graph.UsersUtility by tracing ListUsers and ListUserDelta into MapUserEntity, focusing on how Id is handled when included in selectedProperties. Reproduce the reported nullable Guid conversion error, then verify that both functions accept Id in selectedProperties and return it without an exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.