-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V5 Clone Team method doesn't have a return result #1778
Comments
Thanks for raising this @idealser Any chance this works out for you? var nativeResponseHandler = new NativeResponseHandler();
var body = new Microsoft.Graph.Teams.Item.Clone.ClonePostRequestBody
{
// params
};
await graphClient.Teams["team-id"].Clone.PostAsync(body, requestConfiguration => requestConfiguration.Options.Add(new ResponseHandlerOption() { ResponseHandler = nativeResponseHandler }));
var responseMessage = nativeResponseHandler.Value as HttpResponseMessage;
var locationheader = responseMessage.Headers.Location.OriginalString; |
Thank you @andrueastman, it works. By the way, is there any plan to change the Clone behaviour to return the created team, like it works now with Create? |
Thanks for confirming. https://learn.microsoft.com/en-us/graph/api/team-clone?view=graph-rest-1.0&tabs=http#response-1 |
But what about Create Team API? It is also async but now SDK wraps the operation result somehow. Why is it different for Clone for ex? https://learn.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0&tabs=csharp |
Also, in case you have a 400 error during the Post call, responseMessage.Headers.Location.will be null, and you will get an ObjectReference exception. So there is a need to add hadling of unsuccessful results since PostAsync won't throw you any error because we have a custom response handler |
I'm migrating from V4. Previously to clone a Team we could use this code:
In V5 it's something like this:
The new V5 Clone method doesn't have a return result. By the fact, Create team request which also worked on V4 with location URL now returns us an instance of created Team. Clone request for some reason doesn't.
What is the recommended approach to get the cloned team in V5?
The text was updated successfully, but these errors were encountered: