Search in sources :

Example 16 with UserCollectionPage

use of com.microsoft.graph.requests.UserCollectionPage in project msgraph-beta-sdk-java by microsoftgraph.

the class UserTests method usersKeyPhotoValueTest.

@Test
public void usersKeyPhotoValueTest() {
    // GET users('<<key>>')/photo/$value
    final UserCollectionPage userCollectionPage = graphServiceClient.users().buildRequest().get();
    for (User user : userCollectionPage.getCurrentPage()) {
        if (user.photo != null) {
            InputStream stream = graphServiceClient.users(userCollectionPage.getCurrentPage().get(0).id).photo().content().buildRequest().get();
            assertNotNull(stream);
            break;
        }
    }
}
Also used : User(com.microsoft.graph.models.User) UserCollectionPage(com.microsoft.graph.requests.UserCollectionPage) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Test(org.junit.jupiter.api.Test)

Example 17 with UserCollectionPage

use of com.microsoft.graph.requests.UserCollectionPage in project msgraph-beta-sdk-java by microsoftgraph.

the class UserTests method getUsersWithCount.

@Test
public void getUsersWithCount() {
    final List<Option> consistencyLevelOptions = Arrays.asList(new HeaderOption("ConsistencyLevel", "eventual"));
    final UserCollectionPage usersWithCount = graphServiceClient.users().buildRequest(consistencyLevelOptions).count().get();
    assertNotNull(usersWithCount);
    assertNotNull(usersWithCount.getCount());
}
Also used : UserCollectionPage(com.microsoft.graph.requests.UserCollectionPage) Option(com.microsoft.graph.options.Option) HeaderOption(com.microsoft.graph.options.HeaderOption) HeaderOption(com.microsoft.graph.options.HeaderOption) Test(org.junit.jupiter.api.Test)

Aggregations

UserCollectionPage (com.microsoft.graph.requests.UserCollectionPage)17 User (com.microsoft.graph.models.User)14 Test (org.junit.jupiter.api.Test)14 ClientException (com.microsoft.graph.core.ClientException)4 HeaderOption (com.microsoft.graph.options.HeaderOption)4 Group (com.microsoft.graph.models.Group)3 GroupCollectionPage (com.microsoft.graph.requests.GroupCollectionPage)3 ArrayList (java.util.ArrayList)3 AttendeeBase (com.microsoft.graph.models.AttendeeBase)2 CalendarGetScheduleParameterSet (com.microsoft.graph.models.CalendarGetScheduleParameterSet)2 DateTimeTimeZone (com.microsoft.graph.models.DateTimeTimeZone)2 DirectoryObject (com.microsoft.graph.models.DirectoryObject)2 EmailAddress (com.microsoft.graph.models.EmailAddress)2 MeetingTimeSuggestionsResult (com.microsoft.graph.models.MeetingTimeSuggestionsResult)2 Option (com.microsoft.graph.options.Option)2 CalendarGetScheduleCollectionPage (com.microsoft.graph.requests.CalendarGetScheduleCollectionPage)2 DirectoryObjectCollectionWithReferencesPage (com.microsoft.graph.requests.DirectoryObjectCollectionWithReferencesPage)2 FileInputStream (java.io.FileInputStream)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2