Extended Native Graph API Support Shipping Soon to SPFx

The SharePoint Dev Ecosystem hosts monthly community calls that are not to be missed. The February 2018 Community call was no different. Fortunately for those of us that are busy, we always have the recorded video’s to queue up on demand.

What I found most existing in the February 2018 call was a demo around Graph API integration, in particular, skip ahead to about 18 minutes in.

Extended Graph API support for SPFx

Paolo Pialorsi @PaoloPia demo’s a new method shipping soon to SPFx that will allow us far greater control and access to to the Graph API! The new features are not actually specific to the Graph API, rather to any Azure Active Directory Application, but the Graph API is one of the more common API’s we are looking to utilize in SPFx solutions.

Currently we only have access to the Groups and Reports endpoints within native SPFx using the GraphHttpClient type, SPFx version 1.4.0-, while the new AadHttpClient type will give us almost unlimited access to Graph. With administrative consent of course.

Under the hood

SPFx version 1.4.1 includes the beta release of the new classes, thus it appears as though we will make to few changes to our codebase to utilize the new libraries.

First, we will modify package-solution.json to include the specific permissions our solution will require. Be aware that just because a solution requests certain permissions does not mean these permissions will be granted. When an admin is provisioning a solution to SPO, they will have to explicitly consent to allow the requested permissions.

Second, we will need to begin migrating our Graph requests to the new AadHttpClient type. I look forward to the detailed documentation around this new functionality.

Third, as I already mentioned, upon deployment of the SPFx solution, the administrator will have to consent to granting the requested permissions.

Conclusion

When SPFx went GA last year, many of were yearning for additional native Graph API access. Obviously Microsoft heard us loud and clear and is answering our call.

I look forward to AadHttpClient going GA. How about you? If you haven’t watched the recording, do so now! https://www.youtube.com/watch?v=pVBWDZyTBLk Is this a feature you were looking for, and if so, do you think Microsoft got the implementation right? If not, how can this be improved?

Comments

  1. Thomas Bak says:

    This is a much anticipated feature! In your professional opinion, when would it be reasonable to expect GA? We’re building an application currently with expected release in April and I’d love to skip OAUTH implicit flow for this. 🙂

    • I wish I could state the timeframe for GA, but I do not know and Microsoft has yet to say. March 2018 is not unreasonable, although it may have to push to April or May. If I were you, I suggest updating SPFx to 1.4.1 and build your solution using the latest Graph client class in SPFx. I will provide a much better UX any which way you look at it. You will need to dev on a target release tenant if you do not have one. The catch is that April timeframe. If there is any way you could ship your application no matter if you include the specific graph aspects or not, I would do all I could to encourage that path. That way if GA pushed to May, you wouldn’t have wasted all of that time doing OAuth yourself.

Speak Your Mind

*