I asking the exact question as this post here : How to get a response headers using Microsoft graph API
The only difference (to me?) is that i'm using MSGraphClientFactory.getClient() from '@microsoft/sp-http' instead of { Client } from @microsoft/microsoft-graph-client.
My code so far :
const Rawresponse = graphClient.api("/teams/" + groupID + '/archive')
.version('v1.0')
.responseType("raw")
.post((error, responseRaw) => {
console.log(error);
console.log(responseRaw);}
).then(response => console.log("then response : ", response.header));
Doc about the request itself.
Thanks in advance
PS : found this post along with the mentionned doc but nothing work. Afterthought : not quite suprising that the code in the client's doc doesn't work since I'm not using the client.
Found it !
const response = await graphClient
.api("/teams/" + groupID + '/archive')
.version('v1.0')
.responseType("raw")
.post({ "state": "archived" } , (error, resp, rawresponse) => {
console.log("Error : ", error);
console.log("Response : ", resp);
console.log("RawResp :", rawresponse);
});
console.log("Location :", response.headers.get("location"));
Apparently I needed to unclude {"state" : "archived"}
as context of the post request.
I isn't stated in the doc so I'm not sure why