Код: Выделить всё
final UsernamePasswordCredential credential = new UsernamePasswordCredentialBuilder()
.clientId(clientId).tenantId(tenantId).username(userName).password(password)
.build();
final GraphServiceClient graphClient = new GraphServiceClient(credential, scopes);
GetAllSitesGetResponse getAllSitesGetResponse = graphClient.sites().getAllSites().get();
List value = getAllSitesGetResponse.getValue();
Исключение в потоке «main» com.microsoft.graph.models.odataerrors .ODataError: Доступ запрещен
на com.microsoft.graph.models.odataerrors.ODataError.createFromDiscriminatorValue(ODataError.java:36)
на com.microsoft.kiota.serialization.JsonParseNode.getObjectValue(JsonParseNode.java) :212)
на com.microsoft.kiota.http.OkHttpRequestAdapter.lambda$throwIfFailedResponse$0(OkHttpRequestAdapter.java:674)
на com.microsoft.kiota.ApiExceptionBuilder.(ApiExceptionBuilder.java:26)на com.microsoft.kiota.http.OkHttpRequestAdapter.throwIfFailedResponse(OkHttpRequestAdapter.java:673)
на com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:281)
на com.microsoft.graph.sites.getallsites.GetAllSitesRequestBuilder.get(GetAllSitesRequestBuilder.java:60)
на com.microsoft.graph.sites.getallsites.GetAllSitesRequestBuilder.get(GetAllSitesRequestBuilder.java:46)Я использую последнюю версию зависимости Graph.
Код: Выделить всё
com.microsoft.graph
microsoft-graph
6.13.0
com.microsoft.graph
microsoft-graph-core
3.1.14
Подробнее здесь: https://stackoverflow.com/questions/787 ... using-java
Мобильная версия