microsoft-graph-api - 更新和删除日历事件而不向与会者发送通知

我们需要通过 MS Graph API 更新/删除用户日历中的约会事件, 不会向与会者发送更改通知。我找不到任何选项来控制它。在 EWS API 中,我们能够使用选项来控制它。

appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone);

我们找到了更新的解决方法。如果我们创建一个新的空 Event 对象实例并设置现有约会的 ID 和自定义属性数据,则不会发送通知。这对我们的案例来说已经足够了。但是我们不能用它来删除。

最佳答案

您可以使用 Microsoft Identity Client nuget 包和 OAuthCredentials 继续像以前一样使用 EWS。您必须通过 Azure 应用注册授予 EWS.AccessAsUser.All 权限。这是迄今为止我发现的删除 EWS 基本身份验证的最佳方法。

string clientId = "Your Clinet Id";
string tenantId = "your Tenant Id";
string[] scopes = { "https://outlook.office365.com/EWS.AccessAsUser.All" };
Microsoft.Identity.Client.IPublicClientApplication publicClientApplication = Microsoft.Identity.Client.PublicClientApplicationBuilder.Create(clientId).WithTenantId(tenantId).Build();

System.Security.SecureString secureString = new System.Security.SecureString();
foreach (char ch in password)
     secureString.AppendChar(ch);

Microsoft.Identity.Client.AcquireTokenByUsernamePasswordParameterBuilder authBuilder = publicClientApplication.AcquireTokenByUsernamePassword(scopes, userName, secureString);
Microsoft.Identity.Client.AuthenticationResult result = await authBuilder.ExecuteAsync();

ExchangeService service = new ExchangeService
{
     Credentials = new OAuthCredentials(result.AccessToken)
};

https://stackoverflow.com/questions/58094438/

相关文章:

visual-studio-code - 如何使用 Visual Studio Code + VSC

azure - 作为 Azure DevOps 发布管道的一部分从应​​用服务中删除文件

reactjs - 如何使用带有反应最终形式的自定义 radio 组件?

python - Airflow 外部任务传感器卡​​住

react-native - 在 native react 中使用相机捕获方框内的区域

java - 尝试通过运行 `mvn test` 来运行测试时 JVM 崩溃

php - 未定义的方法 Laravel\Lumen\Application::booted()

javascript - 从 JSON 响应中删除 '@' 作为 String() 后,在 WSO2

ruby-on-rails - 仅导入主文件时,SASS 变量不起作用

jwt - 将 on_premise_sam_account 属性添加到 Azure 广告的 JWT