SOLVED

How to get a list of all users in Office365 tenant

%3CLINGO-SUB%20id%3D%22lingo-sub-15367%22%20slang%3D%22en-US%22%3EHow%20to%20get%20a%20list%20of%20all%20users%20in%20Office365%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-15367%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20custom%20form%20inside%20SharePoint%20online.%20I've%20been%20asked%20to%20create%20a%20dropdown%20with%20the%20first%20name%20%2B%20last%20name%20of%20all%20users%20in%20my%20Office%20365%20tenant.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20only%20way%20I%20can%20think%20to%20get%20that%20information%20client%20side%20is%20Microsoft%20Graph%20but%20I'm%20having%20a%20really%20hard%20time%20finding%20simple%20examples%20that%20show%20how%20to%20use%20ADAL.js%20and%20Graph.%20All%20the%20examples%20I'm%20seeing%20are%20using%20Angular%2C%20NodeJS%2C%20.NET%20or%20other%20platforms%20when%20I%20just%20want%20to%20do%20simple%20jQuery%20ajax%20calls%20to%20Graph%20and%20parse%20the%20results%20into%20an%20array.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20someone%20point%20me%20in%20the%20right%20direction%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-15367%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPIs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-15424%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20a%20list%20of%20all%20users%20in%20Office365%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-15424%22%20slang%3D%22en-US%22%3Ehave%20you%20seen%20this%20sample%2C%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FPnP%2Ftree%2F07e5a1380418223952b94f32a7389b19182f5346%2FComponents%2FCore.PeoplePicker%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FOfficeDev%2FPnP%2Ftree%2F07e5a1380418223952b94f32a7389b19182f5346%2FComponents%2FCore.PeoplePicker%3C%2FA%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-15377%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20a%20list%20of%20all%20users%20in%20Office365%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-15377%22%20slang%3D%22en-US%22%3EHey%20Dean%2C%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20data%20is%20stored%20in%20a%20SP%20List%20but%20the%20form%20is%20all%20HTML.%20The%20people%20picker%20is%20great%20for%20the%20UI%20but%20I%20still%20need%20to%20be%20able%20to%20pull%20all%20the%20users%20in%20the%20tenant.%20Fabric%20UI%20won't%20get%20the%20data%20for%20you%2C%20just%20present%20it.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-15375%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20a%20list%20of%20all%20users%20in%20Office365%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-15375%22%20slang%3D%22en-US%22%3EHow%20did%20you%20create%20the%20form%3F%20are%20you%20using%20a%20SP%20list%3F%20have%20you%20seen%20the%20Office%20UI%20Fabric%20People%20Picker%2C%20%3CA%20href%3D%22http%3A%2F%2Fdev.office.com%2Ffabric%23%2Fcomponents%2Fpeoplepicker%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fdev.office.com%2Ffabric%23%2Fcomponents%2Fpeoplepicker%3C%2FA%3E%3F%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-15371%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20a%20list%20of%20all%20users%20in%20Office365%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-15371%22%20slang%3D%22en-US%22%3EReading%20through%20it%20now.%20I%20love%20how%20he%20says%20%22I%20failed%20to%20find%20a%20simple%20example%20of%20how%20to%20achieve%20this%2C%20my%20search%20results%20often%20filled%20with%20examples%20of%20calling%20the%20APIs%20from%20server-side%20code%20or%20else%20utilising%20the%20Angular.js%20framework%22%2C%20that%20was%20exactly%20my%20experience.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-15370%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20a%20list%20of%20all%20users%20in%20Office365%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-15370%22%20slang%3D%22en-US%22%3E%3CP%3EHave%20you%20seen%20this%20example%3A%26nbsp%3B%3CA%20href%3D%22http%3A%2F%2Fpaulryan.com.au%2F2015%2Funified-api-adal%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fpaulryan.com.au%2F2015%2Funified-api-adal%2F%3C%2FA%3E%3F%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

I have a custom form inside SharePoint online. I've been asked to create a dropdown with the first name + last name of all users in my Office 365 tenant. 

 

The only way I can think to get that information client side is Microsoft Graph but I'm having a really hard time finding simple examples that show how to use ADAL.js and Graph. All the examples I'm seeing are using Angular, NodeJS, .NET or other platforms when I just want to do simple jQuery ajax calls to Graph and parse the results into an array. 

 

Can someone point me in the right direction 

5 Replies
Highlighted
Best Response confirmed by Kessy Similien (Occasional Contributor)
Solution

Have you seen this example: http://paulryan.com.au/2015/unified-api-adal/?

Regards

Highlighted
Reading through it now. I love how he says "I failed to find a simple example of how to achieve this, my search results often filled with examples of calling the APIs from server-side code or else utilising the Angular.js framework", that was exactly my experience.
Highlighted
How did you create the form? are you using a SP list? have you seen the Office UI Fabric People Picker, http://dev.office.com/fabric#/components/peoplepicker?
Highlighted
Hey Dean,

The data is stored in a SP List but the form is all HTML. The people picker is great for the UI but I still need to be able to pull all the users in the tenant. Fabric UI won't get the data for you, just present it.