I got an high trusted provider hosted application that use the App Only Policy. If I try to use server object model, sharepoint returns a context error. Is it possible to use the client object model to read secure store credentials?



This is something that is not possible, however you may create a custom web services instead as a work around.

This C# solution will be able to help you to build your web-services to get credentials,

Retrieving Credentials from the SharePoint Secure Store using C#

  • Hi Muhammad,thanks for the answer, but this is not the solution for me. Your example uses a SP webpart (that has a SPContext defined), instead, I need an example that help me to retrieve the credentials for a provider hosted apps with App Only Policy. In this envainment I don't have a valid SPContext. – Domenico Mar 6 '14 at 14:22
  • @Domenico The example I have provided link for creates a proxy web services, and consumes it within a webpart, however what you need to do is to, create a web services similar to one in solution (in link), then call these web services in your highly trusted provider hosted application – Muhammad Raja Mar 6 '14 at 14:27

I guess, you need the credentials so as to connect to an external system from under the provider-hosted add-in. In this case you may not need the credentials as such, but you can create an external content type and access a list based on this ECT in order to read the data from the external system. So the solution may be:

  1. Create an ECT for the external system you need the data from.
  2. Create a list based on this ECT.
  3. Read the list from your PHAI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.