DiskQuotaControl.FindUser method

Finds a user's entry, by name, in the volume's quota file.

Syntax

DiskQuotaControl.FindUser(
  sLogonName
)

Parameters

sLogonName

Type: String

A string value that contains the user's logon name.

Return value

Returns an object expression that evaluates to the user's DIDiskQuotaUser object.

Remarks

This method returns a DIDiskQuotaUser object even if there is no entry for the user in the quota file. The returned user object has warning threshold and hard quota limits set to the volume's default values.

The string returned from TranslateLogonNameToSID may be passed in place of the sLogonName parameter. When FindUser receives a SID string it uses the corresponding SID for direct lookup of the user's quota record on the volume. This bypasses the SID-name cache. In cases where FindUser fails due to a mismatch in format (for example, SAM-compatible and UPN) of the logon name provided and the logon name cached, the logon name can be translated to a SID string using TranslateLogonNameToSID then passed again to FindUser. The following VBScript code illustrates this technique.

Function Find(dqc, name)
    On Error Resume Next
    SET Find = dqc.FindUser(name)

    If Err.Number <> 0 Then
        Err.Clear
        SET Find = dqc.FindUser(dqc.TranslateLogonNameToSID(name))
    End If    

End Function

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
DLL
Shell32.dll (version 5.0 or later)

See also

DiskQuotaControl Object