简体   繁体   中英

GraphServiceClient and its usage programmatically

I am trying to create a group calendar using C# code and GraphServiceClient . I already got a 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?

  2. Is there any log service which can help me understand why graphClient.Groups.Request() calls are not responding?

Based on my test, it just works.

When debug it, I can get the group object:

在此处输入图像描述

By analyzing with Fiddler, I can double check that the group creating request get a success.

在此处输入图像描述


So:

1. Is there any way to validate the "GraphServiceClient object" value?

I do not think that you need to validate it. If the GraphServiceClient object is invalid, you will get an error exception.

2. Is there any log service which can help me understand why "graphClient.Groups.Request()" calls are not responding?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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