Programmatically add users to Secure Store Service in SharePoint 2013
-
10-12-2019 - |
Question
I've set up SQL credentials in my site's Secure Store Service and would like to add people to the members of this group programmatically (using C#) but am having trouble with the API. I've found some references but I can't seem to find where some things exist (specifically ISecureStoreServiceContext http://msdn.microsoft.com/en-us/library/microsoft.office.securestoreservice.server.isecurestoreservicecontext.aspx which uses a .dll I can't find in /Common Files/microsoft shared/Web Server Extensions/15/ISAPI). Although I do see Microsoft.Office.SecureStoreService.Server.Security.dll but this only seems to give me part of the API. Does anyone have an up-to-date solution for SharePoint 2013 to add users in this way?
Solution
You need to add a reference to Microsoft.Office.SecureStoreService.dll, which is in the GAC. You can paste this when creating the reference:
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Office.SecureStoreService\v4.0_15.0.0.0__71e9bce111e9429c\Microsoft.Office.SecureStoreService.dll