首页 > 解决方案 > MSGraph API unarchive Team 和 restore Group 不起作用

问题描述

当您在 Azure 中删除组时,MSTeams 中存在一个错误(我认为),MSTeams 中的团队仍然可用。所以我在删除组之前将其存档。

现在我想取消归档并恢复组。这些电话都不起作用...

graphApplicationClient.teams({teamId}).unarchive().buildRequest().post();

错误:

    Apr. 24, 2020 5:01:55 PM com.microsoft.graph.logger.DefaultLogger logDebug
INFORMATION: Starting to send request, URL https://graph.microsoft.com/v1.0/teams/{teamId}/microsoft.graph.unarchive
Apr. 24, 2020 5:01:55 PM com.microsoft.graph.logger.DefaultLogger logDebug
INFORMATION: Request Method POST
Apr. 24, 2020 5:01:55 PM com.microsoft.graph.logger.DefaultLogger logError
SCHWERWIEGEND: CoreHttpProvider[send] - 204Error during http request
Apr. 24, 2020 5:01:55 PM com.microsoft.graph.logger.DefaultLogger logError
SCHWERWIEGEND: Throwable detail: com.microsoft.graph.core.ClientException: Error during http request
Exception in thread "main" com.microsoft.graph.core.ClientException: Error during http request
    at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:421)
    at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:204)
    at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:184)
    at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:306)
    at com.microsoft.graph.requests.extensions.TeamUnarchiveRequest.post(TeamUnarchiveRequest.java:62)
    at MSTeamsService.main(MSTeamsService.java:65)
Caused by: java.lang.NullPointerException
    at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1770)
    at java.base/java.util.regex.Matcher.reset(Matcher.java:416)
    at java.base/java.util.regex.Matcher.<init>(Matcher.java:253)
    at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
    at okhttp3.MediaType.get(MediaType.java:53)
    at okhttp3.MediaType.parse(MediaType.java:106)
    at com.microsoft.graph.http.CoreHttpProvider$3.contentType(CoreHttpProvider.java:346)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:53)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at com.microsoft.graph.httpcore.TelemetryHandler.intercept(TelemetryHandler.java:35)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at com.microsoft.graph.httpcore.RedirectHandler.intercept(RedirectHandler.java:123)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at com.microsoft.graph.httpcore.RetryHandler.intercept(RetryHandler.java:140)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at com.microsoft.graph.httpcore.AuthenticationHandler.intercept(AuthenticationHandler.java:31)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
    at okhttp3.RealCall.execute(RealCall.java:92)
    at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:355)
    ... 5 more

另一个电话:

     graphApplicationClient.directory().deletedItems({team/groupId}).restore().buildRequest().post();

错误:

    Apr. 24, 2020 5:04:14 PM com.microsoft.graph.logger.DefaultLogger logDebug
INFORMATION: Starting to send request, URL https://graph.microsoft.com/v1.0/directory/deletedItems/{team/groupId}/microsoft.graph.restore
Apr. 24, 2020 5:04:14 PM com.microsoft.graph.logger.DefaultLogger logDebug
INFORMATION: Request Method POST
Apr. 24, 2020 5:04:14 PM com.microsoft.graph.logger.DefaultLogger logError
SCHWERWIEGEND: CoreHttpProvider[send] - 204Error during http request
Apr. 24, 2020 5:04:14 PM com.microsoft.graph.logger.DefaultLogger logError
SCHWERWIEGEND: Throwable detail: com.microsoft.graph.core.ClientException: Error during http request
Exception in thread "main" com.microsoft.graph.core.ClientException: Error during http request
    at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:421)
    at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:204)
    at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:184)
    at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:306)
    at com.microsoft.graph.requests.extensions.DirectoryObjectRestoreRequest.post(DirectoryObjectRestoreRequest.java:53)
    at MSTeamsService.main(MSTeamsService.java:66)
Caused by: java.lang.NullPointerException
    at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1770)
    at java.base/java.util.regex.Matcher.reset(Matcher.java:416)
    at java.base/java.util.regex.Matcher.<init>(Matcher.java:253)
    at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
    at okhttp3.MediaType.get(MediaType.java:53)
    at okhttp3.MediaType.parse(MediaType.java:106)
    at com.microsoft.graph.http.CoreHttpProvider$3.contentType(CoreHttpProvider.java:346)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:53)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at com.microsoft.graph.httpcore.TelemetryHandler.intercept(TelemetryHandler.java:35)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at com.microsoft.graph.httpcore.RedirectHandler.intercept(RedirectHandler.java:123)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at com.microsoft.graph.httpcore.RetryHandler.intercept(RetryHandler.java:140)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at com.microsoft.graph.httpcore.AuthenticationHandler.intercept(AuthenticationHandler.java:31)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
    at okhttp3.RealCall.execute(RealCall.java:92)
    at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:355)
    ... 5 more

(SCHWERWIEGEND 意味着致命)

如果我在 GraphExplorer 中尝试这些调用,它们工作正常。

有人能帮我吗?

此致!

标签: javamicrosoft-graph-apimicrosoft-teams

解决方案


对于和我有同样问题的每个人。GraphAPI 提供了一个 customRequest() 函数。我使用相同的令牌、相同的 url、相同的属性,但使用的是 customRequest。

graphApplicationClient.customRequest("/teams/" + pTeamId + "/unarchive").buildRequest().post(new JsonObject());

相同的恢复解决方案..

graphApplicationClient.customRequest("/directory/deletedItems/" + pTeamId + "/restore").buildRequest().post(new JsonObject()

这不是正确的解决方案,因为它应该与普通的 GraphAPI 一起使用,这就是为什么我不将其标记为答案的原因。但这对于遇到相同问题的每个人来说都是一种解决方法..


推荐阅读