如何从 Microsoft Graph 中获取响应代码或状态删除成员 API?
How to get response code or status from Microsoft Graph remove member API?
我正在使用 Graph API 删除成员 API 从组中删除成员。成功删除后,api.
没有任何回应
export async function removeGroupMember(accessToken, groupId, memberId) {
const client = getAuthenticatedClient(accessToken);
client
.api("/groups/" + groupId + "/members/" + memberId + "/$ref")
.delete()
.then((res) => {
console.log(res); //undefined
console.log(res.status); //undefined
});
}
我在文档中读到它不会 return 任何响应正文,但它会 return 成功删除后的响应代码 204。如何获取响应代码?
现在上面的代码正在执行工作,我可以使用上面的代码删除成员,我在 Azure 门户中进行了验证。但我需要在前端做出某种响应,让用户知道该成员已被删除。用于错误处理目的。我不确定这是 Javascript 问题还是图表 API,Azure AD 问题。
尝试获取原始响应:
export async function removeGroupMember(accessToken, groupId, memberId) {
const client = getAuthenticatedClient(accessToken);
client
.api("/groups/" + groupId + "/members/" + memberId + "/$ref")
.delete()
.responseType(MicrosoftGraph.ResponseType.RAW)
.then((res) => {
console.log(res.status);
});
}
我不确定它是否适用于没有 return 任何响应正文的删除
我正在使用 Graph API 删除成员 API 从组中删除成员。成功删除后,api.
没有任何回应export async function removeGroupMember(accessToken, groupId, memberId) {
const client = getAuthenticatedClient(accessToken);
client
.api("/groups/" + groupId + "/members/" + memberId + "/$ref")
.delete()
.then((res) => {
console.log(res); //undefined
console.log(res.status); //undefined
});
}
我在文档中读到它不会 return 任何响应正文,但它会 return 成功删除后的响应代码 204。如何获取响应代码?
现在上面的代码正在执行工作,我可以使用上面的代码删除成员,我在 Azure 门户中进行了验证。但我需要在前端做出某种响应,让用户知道该成员已被删除。用于错误处理目的。我不确定这是 Javascript 问题还是图表 API,Azure AD 问题。
尝试获取原始响应:
export async function removeGroupMember(accessToken, groupId, memberId) {
const client = getAuthenticatedClient(accessToken);
client
.api("/groups/" + groupId + "/members/" + memberId + "/$ref")
.delete()
.responseType(MicrosoftGraph.ResponseType.RAW)
.then((res) => {
console.log(res.status);
});
}
我不确定它是否适用于没有 return 任何响应正文的删除