srishti purohit
srishti purohit

Reputation: 51

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?

Upvotes: 1

Views: 1558

Answers (1)

Jack Jia
Jack Jia

Reputation: 5549

Based on my test, it just works.

When debug it, I can get the group object:

enter image description here

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

enter image description here


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.

Upvotes: 1

Related Questions