Summary: Learn how to use the cross-domain library in apps for SharePoint to get groups and users in a grid from an app web.
Source Code: Get Groups and Users
Last modified: 8/24/2016
Description of the sample
The code that uses the cross-domain library and a third party grid control provided by jQWidgets. The control used in this sample is a trial version. The grid displays all the subsite, user groups of each subsite and users of each group. Grid features like grouping, sorting and filtering are enabled in this app. Grouping feature of this grid helps to get the list of all users, get all groups a user is member of, and all users and groups from site collection.
Figure 1. Browser window display the grid grouped by Web and Group.
This sample requires the following:
- Visual Studio 2015
- Office Developer Tools for Visual Studio 2015
- A SharePoint 2013 development environment
For more information, see Get started developing apps for SharePoint.
Key components of the sample
The sample contains the following:
- GetUserGroups project, which contains the AppManifest.xml file
- GetUserGroups project
- App.js file, which contains code to fetch data and display results
Configure the sample
Follow these steps to configure the sample.
- Update the SiteUrl property of the solution with the URL of the home page of your SharePoint website.
Run and test the sample
- Press F5 to build and deploy the app.
- Choose Trust It on the consent page to grant permissions to the app.
You should see an HTML page that displays five announcements.
For troubleshooting steps, visit the Troubleshooting the solution table in the cross-domain library documentation article.