Skip to content

DeleteUser (OP-05)

Request and response

Part Type Description
inUserId String The SamAccountName of the account to delete.
Part Type Description
<return> ADServiceResponse Response is Success (including when no principal was found) or Failure. Message carries the caught exception text on a Failure, otherwise empty.

WebMethod attributes

<WebMethod()> — bare, no arguments supplied.

Steps

  1. CheckAccess(); on denial return AccessDenied() (BR-01).
  2. Call H1 GetContext for the external domain into an unused local.
  3. Call H2 GetUserPrincipal for the external domain.
  4. Initialize the response sentinel to Success.
  5. If a principal was found:
  6. userPrin.Delete() inside Try.
    • On exception, set Response = Failure, Message = ex.Message.
  7. Finally releases the principal.
  8. If no principal was found, do nothing and fall through (BR-18) — a non-existent user and a directory-lookup failure both return Success; deletion is reported as idempotent but is not distinguishable from a silent failure.
  9. Return the response sentinel.

Process flow

flowchart TD
    A["Call DeleteUser"] --> B{"CheckAccess<br>HasAccess?"}
    B -->|"No"| C["Return AccessDenied"]
    B -->|"Yes"| D["GetUserPrincipal<br>external domain"]
    D -->|"Found"| E["userPrin.Delete<br>in Try/Catch"]
    E -.->|"Exception"| F["Set Failure + ex.Message"]
    E --> G["Return response"]
    F --> G
    D -->|"Nothing"| H["Fall through<br>leave Success"]
    H --> G

Shared state effects

None — this operation touches no process-wide state; all locals are per-request.

Error handling

The operation always returns a sentinel ADServiceResponse. It never surfaces a framework SOAP fault from a caught Delete() failure. See Faults for the service-wide fault model.

Authorization

Gated by BR-01: the caller must pass the IP allow-list check enforced by CheckAccess. See Authentication and authorization.

Sources

  • src\ADUserServices\clsADUserServices.asmx.vb (lines 270-295)