简体   繁体   English

GraphServiceClient 及其以编程方式使用

[英]GraphServiceClient and its usage programmatically

I am trying to create a group calendar using C# code and GraphServiceClient .我正在尝试使用 C# 代码和GraphServiceClient创建组日历。 I already got a GraphServiceClient object.我已经有一个GraphServiceClient object。 But as soon as I call the below code, nothing happens.但是只要我调用下面的代码,什么都没有发生。 There is no response of the call.呼叫没有响应。 It just calls and forgets.它只是调用并忘记。

Group group = await graphClient.Groups.Request()

        //.WithUserAccount(ClaimsPrincipal.Current.ToGraphUserAccount())

        .AddAsync(new Group

        {
            GroupTypes = new List<string> { "Unified" },
            DisplayName = "Test",
            Description = "Test",
            MailNickname = "Test",
            MailEnabled = false,
            SecurityEnabled = false
        });

Questions I have:我的问题:

  1. Is there any way to validate the GraphServiceClient object value?有什么方法可以验证GraphServiceClient object 值?

  2. Is there any log service which can help me understand why graphClient.Groups.Request() calls are not responding?是否有任何日志服务可以帮助我理解为什么graphClient.Groups.Request()调用没有响应?

Based on my test, it just works.根据我的测试,它可以正常工作。

When debug it, I can get the group object:调试时,我可以得到组 object:

在此处输入图像描述

By analyzing with Fiddler, I can double check that the group creating request get a success.通过使用 Fiddler 进行分析,我可以仔细检查组创建请求是否成功。

在此处输入图像描述


So:所以:

1. Is there any way to validate the "GraphServiceClient object" value? 1. 有什么方法可以验证“GraphServiceClient 对象”的值吗?

I do not think that you need to validate it.我认为您不需要验证它。 If the GraphServiceClient object is invalid, you will get an error exception.如果 GraphServiceClient object 无效,会报错异常。

2. Is there any log service which can help me understand why "graphClient.Groups.Request()" calls are not responding? 2. 是否有任何日志服务可以帮助我理解为什么“graphClient.Groups.Request()”调用没有响应?

Based on my test, it just works.根据我的测试,它可以正常工作。 You may debug it or use Fiddler to capture the traffic to see if any request was made.您可以调试它或使用 Fiddler 捕获流量以查看是否有任何请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM