Sharepoint 2013 Microsoft.Office.SecureStoreService.dll

The Microsoft.Office.SecureStoreService.dll is needed if you want to programmatically retrieve credentials from SSS. In SPS 2013 (windows server 2012) you can find this dll in:

c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Office.SecureStoreService\v 4.0_15.0.0.0__71e9bce111e9429c

You can use cmd to navigate to that directory and copy the dll to use as a reference in your Visual Studio Project.

(more info:

The sample code to retrive credentials (the applicationId is a property in my webpart and it is the value of a SSS application created in Central Administration, Secure Store Service):

private void MyWebPart_Load(object sender, EventArgs e)
   if (!String.IsNullOrEmpty(applicationId))
     // Get the default Secure Store Service provider.
     ISecureStoreProvider provider = SecureStoreProviderFactory.Create();
     if (provider == null)
       throw new InvalidOperationException("Unable to get an ISecureStoreProvider");
     ISecureStoreServiceContext providerContext = provider as       ISecureStoreServiceContext;
     providerContext.Context = SPServiceContext.Current;
      using (SecureStoreCredentialCollection creds = provider.GetCredentials (ApplicationId))
        Debug.Assert(creds != null);

        if (creds != null)
         foreach (SecureStoreCredential cred in creds)
           if (cred == null)

          switch (cred.CredentialType)
           case SecureStoreCredentialType.UserName:
           case SecureStoreCredentialType.WindowsUserName:
           if (username == null)
            username = GetStringFromSecureString(cred.Credential);
           case SecureStoreCredentialType.WindowsPassword:
           case SecureStoreCredentialType.Password:
           if (password == null)
            password = GetStringFromSecureString(cred.Credential);
         } //switch
   if (username == null || password == null)
    throw new InvalidOperationException("Unable to get the credentials");
   this.mustSetCredentials = false;
  catch (SecureStoreException ex)
    this.mustSetCredentials = true;


Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: