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 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 PasswordVault()Public Function PasswordVault() As

Methods

  • Add(Windows.Security.Credentials.PasswordCredential)
    Add(Windows.Security.Credentials.PasswordCredential)
    Add(Windows.Security.Credentials.PasswordCredential)
    Add(Windows.Security.Credentials.PasswordCredential)

    Adds a credential to the Credential Locker.

    public void Add(Windows.Security.Credentials.PasswordCredential)public void Add(Windows.Security.Credentials.PasswordCredential)Public Function Add(Windows.Security.Credentials.PasswordCredential) As void

    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(System.String)
    FindAllByResource(System.String)
    FindAllByResource(System.String)
    FindAllByResource(System.String)

    Searches the Credential Locker for credentials matching the resource specified.

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

    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(System.String)
    FindAllByUserName(System.String)
    FindAllByUserName(System.String)
    FindAllByUserName(System.String)

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

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

    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(Windows.Security.Credentials.PasswordCredential)
    Remove(Windows.Security.Credentials.PasswordCredential)
    Remove(Windows.Security.Credentials.PasswordCredential)
    Remove(Windows.Security.Credentials.PasswordCredential)

    Removes a credential from the Credential Locker.

    public void Remove(Windows.Security.Credentials.PasswordCredential)public void Remove(Windows.Security.Credentials.PasswordCredential)Public Function Remove(Windows.Security.Credentials.PasswordCredential) As void

    Parameters

  • Retrieve(System.String,System.String)
    Retrieve(System.String,System.String)
    Retrieve(System.String,System.String)
    Retrieve(System.String,System.String)

    Reads a credential from the Credential Locker.

    public PasswordCredential Retrieve(System.String,System.String)public PasswordCredential Retrieve(System.String,System.String)Public Function Retrieve(System.String,System.String) As PasswordCredential

    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 )

    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.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.Security.Credentials.dll