The Graph.Community library uses a versioning scheme that tracks the official .Net SDK, so the 3.18 release number hides some substantial updates. 🙂
SharePoint Site Groups
The Web request now includes a SiteGroups property that will return a list of SharePoint Groups in the site. This correlates to the _layouts/15/groups.aspx
page in the user interface. Additionally, the SiteGroup request includes an Expand
method that will include the members of the groups in the same request.
var groups = await graphServiceClient
.SharePointAPI(WebUrl)
.Web
.SiteGroups
.Request()
.Expand(g => g.Users)
.GetAsync();
Interactive token acquisition and file-based token cache
The sample program uses the Device Code flow to acquire a token. This release includes a sample (SiteGroups.cs) that uses recently-published capabilities in the Microsoft Authentication Library (MSAL).
- MSAL.Net leverages the system-browser to facilitate an interactive login experience when using a PublicClientApplication. The official docs discuss the various redirect URIs, but the wiki in the GitHub repo has this nugget:
On .NET Core, MSAL will start the system browser as a separate process. MSAL does not have control over this browser, but once the user finishes authentication, the web page is redirected in such a way that MSAL can intercept the Uri.
- Rather than requiring a login each time the sample is executed (as the device core requires), the SiteGroups sample uses a file-based token cache. This cache is explained in the official documentation: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-net-token-cache-serialization
- MSAL.Net logging is included, which is incredibly helpful when diagnosing issues with token acquisition/caching.
As always, feedback is appreciated. Open an issue, or submit a PR. (Lots of ideas in the roadmap document!)