#windows #graph
Вопрос:
У меня есть проект aproject на Java. Когда я запускаю проект, я получил ошибку: GetGroupFromIdS2SRequest. Рабочая нагрузка MsGraph_DirectoryServices, кто-нибудь сказал бы мне, как это исправить?.
SpringApplication.run(DemoApplication.class, args);
final ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder().clientId("xxxx").clientSecret("yyyy").tenantId("zzzz").build();
List<String> scope = new ArrayList<>();
scope.add("https://graph.microsoft.com/.default");
final TokenCredentialAuthProvider tokenCredentialAuthProvider = new TokenCredentialAuthProvider( scope, clientSecretCredential);
final GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider(tokenCredentialAuthProvider).buildClient();
GroupCollectionPage groupCollectionPage = graphClient.groups().buildRequest().get();
Group group = new Group();
group.description = "Group with designated owner and members207";
group.displayName = "Operations group207";
LinkedList<String> groupTypesList = new LinkedList<String>();
groupTypesList.add("Unified");
group.groupTypes = groupTypesList;
group.mailEnabled = false;
group.mailNickname = "operations207";
group.securityEnabled = true;
group.additionalDataManager().put(""owners@odata.bind"", new JsonPrimitive("[ "https://graph.microsoft.com/v1.0/directoryObjects/11111111"]"));
String sIdGrupo = graphClient.groups().buildRequest().post(group).id;
Team team = new Team();
TeamMemberSettings memberSettings = new TeamMemberSettings();
memberSettings.allowCreateUpdateChannels = true;
team.memberSettings = memberSettings;
TeamMessagingSettings messagingSettings = new TeamMessagingSettings();
messagingSettings.allowUserEditMessages = true;
messagingSettings.allowUserDeleteMessages = true;
team.messagingSettings = messagingSettings;
TeamFunSettings funSettings = new TeamFunSettings();
funSettings.allowGiphy = true;
funSettings.giphyContentRating = GiphyRatingType.STRICT;
team.funSettings = funSettings;
graphClient.groups(sIdGrupo).team().buildRequest().put(team);
Ответ №1:
Перед: Team team = новая команда();, Я добавил эту строку:
try {
sleep(30000);
} catch (InterruptedException e) {
e.printStackTrace();
}