Skip to main content
ICredentialProviderUserArray::GetAt method

Retrieves a specified user from the array.

Syntax


HRESULT GetAt(
  [in]   DWORD userIndex,
  [out]  ICredentialProviderUser **user
);

Parameters

userIndex [in]

The 0-based array index of the user. The size of the array can be obtained through the GetCount method.

user [out]

The address of a pointer to an object that, when this method returns successfully, represents the specified user. It is the responsibility of the caller to free this object when it is no longer needed by calling its Release method.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code, including the following:

Return codeDescription
E_INVALIDARG

The index specified in userIndex is out of range.

 

Examples

The following example shows the use of this function to walk the array. It assumes that the pcpua parameter is a valid ICredentialProviderUserArray object defined earlier.


DWORD dwCount = 0;

HRESULT hr = pcpua->GetCount(&dwCount);

if (SUCCEEDED(hr))
{
    for (DWORD i = 0; i < dwCount; i++)
    {
        ICredentialProviderUser *pcpu = NULL;
        hr = pcpua->GetAt(i, &pcpu);

        if (SUCCEEDED(hr))
        {
            // TODO: Retrieve user properties.
            pcpu->Release();
        }
    }
}

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

CredentialProvider.h

IDL

CredentialProvider.idl

Library

CredentialProvider.lib

DLL

Authui.dll

See also

ICredentialProviderUserArray