Closed anapeksha closed 7 months ago
Thanks, this is just a case where we have assigned the wrong type to the return. The data is correct and is of type:
import { User } from "@microsoft/microsoft-graph-types";
Kindly help fix it for future releases. Also do update the jsdocs for graph.users.search()
@anapeksha - it would be our intent to do so but also, we accept pull requests since this is a community effort.
Sure! Thank you so much for your help and support.
I also had a question: How to get user photo in the same call as the user search?
As in:
graph.users
.search(email)()
.then((response) => {
setUserResults(response);
})
.catch((error) => {
setError(error);
});
{userResults.map((value, index)=>(
<ul>
<img src={value.photo} alt={value.displayName}/>
<li>{value.displayName}</li>
</ul>
)
Currently, the photo is of type ProfilePhoto and has {id, width, height}. How to make it usable in the img:src.
In the future, please post a new issue if you're changing topic. That said the docs reference the way to get the actual photo: https://pnp.github.io/pnpjs/graph/photos/#current-user-photo
Thank you for the support.
Reopening to track bug.
Closed as after verifying this is typed properly and returning the graph User type. We don't explicitly export the graph types, they should be imported as referenced by @patrick-rodgers above: https://github.com/pnp/pnpjs/issues/2921#issuecomment-1914924175
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.
What version of PnPjs library you are using
3.x
Minor Version Number
22
Target environment
SharePoint Framework
Additional environment details
I am using Node 18.19.0 with typescript 4 and @pnp 3
Question/Request
I am creating a custom PeoplePicker to be used in my other projects. But the problem I noticed was:
Now the response is typed as
User
which is not exported from the library.P.S. - User is a class with type as IGraphInvokableFactory
Suggest how to perfectly type state values without making the variables as type
any
orunknown