以编程方式创建 TeamTab 曾经有效,但现在在更新库后出现错误



您能否帮助我解决在以编程方式创建团队选项卡时因出现此错误而错过的内容?代码一直有效,直到我将图形库更新到以前的图形库的更高级别。

Code: BadRequest
Message: Value cannot be null.
Parameter name: entity
Inner error:
AdditionalData:
request-id: 09211d2b-ed86-4f89-8667-42f749521af1
date: 1/17/2020 8:41:28 AM
ClientRequestId: 09211d2b-ed86-4f89-8667-42f749521af1

下面是一直运行的代码,直到我更新包但现在给出错误。


//Creates Tab object for Dashboard
TeamsTab teamsDashboardTab = new TeamsTab()
{
DisplayName ="My Dashboard",
TeamsAppId = AppId,
Configuration = new TeamsTabConfiguration
{
EntityId = AppId,
ContentUrl = TargetServer + project.Id,
WebsiteUrl = TargetServer + project.Id
}
};
var teamsTab = await _graphClient.Teams[teamId].Channels[channelId].Tabs.Request().AddAsync(teamsDashboardTab);

下面也是我正在使用的图形库的当前版本。

<package id="Microsoft.Graph.Auth" version="1.0.0-preview.2" targetFramework="net452" />
<package id="Microsoft.Graph.Beta" version="0.9.0-preview" targetFramework="net452" />
<package id="Microsoft.Graph.Core" version="1.18.0" targetFramework="net452" />
<package id="Microsoft.Identity.Client" version="4.5.1" targetFramework="net452" />
<package id="System.Security.Principal" version="4.3.0" targetFramework="net452" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net452" />

当我尝试将新的网站选项卡添加到频道时,我遇到了同样的问题。

为了使它正常工作,我必须ODataType设置为TeamsTabConfigurationnull。代码应如下所示:

var tab = await _graphClient.Teams[teamId].Channels[channelId].Tabs.Request().WithMaxRetry(3).AddAsync(
new TeamsTab
{
DisplayName = TabTitle,
ODataBind = $"{_teamsFactory.GraphV1Endpoint}/appCatalogs/teamsApps/com.microsoft.teamspace.tab.web",
Configuration = new TeamsTabConfiguration
{
ODataType = null,
EntityId = null,
WebsiteUrl = $"{_appUrl}/1",
ContentUrl = $"{_appUrl}/1",
RemoveUrl = null
}
});

这只是一种解决方法。它在GitHub上被标记为"服务错误"(问题#598(

最新更新