PasswordVault PasswordVault PasswordVault PasswordVault Class

Represents a Credential Locker of credentials. The contents of the locker are specific to the app or service. Apps and services don't have access to credentials associated with other apps or services.

Syntax

Declaration

public sealed class PasswordVaultpublic sealed class PasswordVaultPublic NotInheritable Class PasswordVaultpublic sealed class PasswordVault

Constructors summary

Creates and initializes a new instance of the PasswordVault object.

Methods summary

Adds a credential to the Credential Locker.

Searches the Credential Locker for credentials matching the resource specified.

Searches the Credential Locker for credentials that match the user name specified.

Removes a credential from the Credential Locker.

Reads a credential from the Credential Locker.

Retrieves all of the credentials stored in the Credential Locker.

Constructors

  • PasswordVault()
    PasswordVault()
    PasswordVault()
    PasswordVault()

    Creates and initializes a new instance of the PasswordVault object.

    public PasswordVault()public New()Public Sub New()public PasswordVault()

Methods

  • Add(PasswordCredential)
    Add(PasswordCredential)
    Add(PasswordCredential)
    Add(PasswordCredential)

    Adds a credential to the Credential Locker.

    public void Add(PasswordCredential credential)public void Add(PasswordCredential credential)Public Function Add(credential As PasswordCredential) As voidpublic void Add(PasswordCredential credential)

    Parameters

    Remarks

    You can only store up to ten credentials per app in the Credential Locker. If you try to store more than ten credentials, you will encounter an Exception.

  • FindAllByResource(String)
    FindAllByResource(String)
    FindAllByResource(String)
    FindAllByResource(String)

    Searches the Credential Locker for credentials matching the resource specified.

    public IVectorView<PasswordCredential> FindAllByResource(String resource)public IVectorView<PasswordCredential> FindAllByResource(String resource)Public Function FindAllByResource(resource As String) As IVectorView( Of PasswordCredential )public IVectorView<PasswordCredential> FindAllByResource(String resource)

    Parameters

    • resource
      System.String
      System.String
      System.String
      System.String

      The resource to be searched for.

    Returns

    • When this method returns, contains an IVectorView of credential objects that match the search criteria.

    Remarks

    Each object returned will have the proper resource and user name, but it will not include the password.

  • FindAllByUserName(String)
    FindAllByUserName(String)
    FindAllByUserName(String)
    FindAllByUserName(String)

    Searches the Credential Locker for credentials that match the user name specified.

    public IVectorView<PasswordCredential> FindAllByUserName(String userName)public IVectorView<PasswordCredential> FindAllByUserName(String userName)Public Function FindAllByUserName(userName As String) As IVectorView( Of PasswordCredential )public IVectorView<PasswordCredential> FindAllByUserName(String userName)

    Parameters

    • userName
      System.String
      System.String
      System.String
      System.String

      The user name to be searched for.

    Returns

    • When this method returns, contains an IVectorView of credential objects that match the search criteria.

    Remarks

    Each object returned will have the proper resource and user name, but it will not include the password.

  • Remove(PasswordCredential)
    Remove(PasswordCredential)
    Remove(PasswordCredential)
    Remove(PasswordCredential)

    Removes a credential from the Credential Locker.

    public void Remove(PasswordCredential credential)public void Remove(PasswordCredential credential)Public Function Remove(credential As PasswordCredential) As voidpublic void Remove(PasswordCredential credential)

    Parameters

  • Retrieve(String, String)
    Retrieve(String, String)
    Retrieve(String, String)
    Retrieve(String, String)

    Reads a credential from the Credential Locker.

    public PasswordCredential Retrieve(String resource, String userName)public PasswordCredential Retrieve(String resource, String userName)Public Function Retrieve(resource As String, userName As String) As PasswordCredentialpublic PasswordCredential Retrieve(String resource, String userName)

    Parameters

    • resource
      System.String
      System.String
      System.String
      System.String

      The resource for which the credential is used.

    • userName
      System.String
      System.String
      System.String
      System.String

      The user name that must be present in the credential.

    Returns

  • RetrieveAll()
    RetrieveAll()
    RetrieveAll()
    RetrieveAll()

    Retrieves all of the credentials stored in the Credential Locker.

    public IVectorView<PasswordCredential> RetrieveAll()public IVectorView<PasswordCredential> RetrieveAll()Public Function RetrieveAll() As IVectorView( Of PasswordCredential )public IVectorView<PasswordCredential> RetrieveAll()

    Returns

    • When this method returns, contains an IVectorView output of credential objects that match the search criteria. This output is a snapshot and not dynamic. If the results are used for updating or deleting credentials, those changes won't be reflected in the previous output.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Security.Credentials.dll