3.5 Delete删除用户

删除也是通过ObjectID获得对象进行删除

[Authorize]
public async Task<ActionResult> Delete(string objectId)
{
    try
    {
        ActiveDirectoryClient client = AuthenticationHelper.GetActiveDirectoryClient();
        var user = (User)await client.Users.GetByObjectId(objectId).ExecuteAsync();
        await user.DeleteAsync();
        return RedirectToAction("Index");
    }
    catch (Exception exception)
    {
        ModelState.AddModelError("", exception.Message);
        return RedirectToAction("Index");
    }
}

相关文章:

  • 2021-07-25
  • 2021-09-24
  • 2021-09-18
  • 2021-11-25
  • 2022-12-23
  • 2021-07-15
  • 2021-12-24
  • 2021-09-04
猜你喜欢
  • 2021-06-01
  • 2021-12-25
  • 2021-12-06
  • 2021-10-15
  • 2021-10-13
  • 2021-11-14
  • 2021-06-24
相关资源
相似解决方案