I'm attempting to use the .NET Microsoft.Graph SDK to create two groups and add one to the other. The group creation is fine and they show up in the Microsoft Graph Explorer. However, when I attempt to add the group to the other group, I get an error:
Microsoft.Graph.ServiceException
HResult=0x80131500
Message=Code: Request_BadRequest
Message: An invalid operation was included in the following modified references: 'members'.
Inner error
Source=Microsoft.Graph.Core
StackTrace:
at Microsoft.Graph.HttpProvider.<SendAsync>d__19.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__36.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.BaseRequest.<SendAsync>d__31.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at [mycode].cs:line 170
I'm adding the group with the following:
await _serviceClient.Groups[memberGroup.Id]
.Members
.References
.Request()
.AddAsync(new Group { Id = adminGroup.Id });
Edit These are security groups