msgraph-sdk-javascript/docs/GettingRawResponse.md at dev · microsoftgraph/msgraph-sdk-javascript

Latest commit

Getting Raw Response

Steps for getting the raw response [i.e Response Object]

Initialize the Client

Refer this documentation for initializing the client.

Getting Raw Response by setting ResponseType

To get the raw response set the responseType of a request to ResponseType.RAW.

const rawResponse = await client
	.api("/me")
	.select("displayName")
	.responseType(ResponseType.RAW)
	.get();
console.log(rawResponse);

Using callback method,

client
	.api("/me")
	.select("displayName")
	.responseType(ResponseType.RAW)
	.get((error, rawResponse) => {
		console.log(rawResponse);
	});