0

I have an AngularJS web app that is registered as a Provider-hosted app on an on-premises SharePoint 2013 site (not Office 365 or SharePoint Online). The Provider-hosted app is hosted on a separate domain than the SharePoint site.

What I'm trying to do is call either the SharePoint REST web services or use JSOM (both client-side calls) to perform CRUD actions on the lists inside the SharePoint site. So far I've been going in circles through the Microsoft documentation and various articles trying to get this working.

So far the closest I've got is to use Microsoft's cross-domain JavaScript library to proxy my web service calls from the provider-hosted app into SharePoint. This solution only partially works because it fails to find the proxy .aspx file that should be hosted inside the app web for my provider-hosted app (it's confusing, but this 'app web' is actually hosted within SharePoint from what I understand). There's a workaround called the apphost pattern, but it makes no sense to me. I'm hoping there's a more straightforward way to accomplish this.

Can anyone explain to me in certain, clear terms how exactly does a Provider-hosted app (on a separate domain) perform CRUD actions via REST/JSOM on the SharePoint site with which it is registered.

Thank you in advance!

UPDATE: Some new information: it seems like the app web is not being created for the app when it gets deployed. We have tried to add a custom list to be deployed with the app which is supposed to trigger the app web to be created, but the list nor the app web are created upon deployement.

  • 1
    This might clear things up. – wjervis Sep 15 '14 at 19:21
  • Have you tried to create a SharePoint Hosted App to see if it actually creates the App Web? This could be an environment configuration issue. – Omar Stewey Sep 16 '14 at 5:33
0

Tips to consider.

  1. Are you declaring a list to be created whe the app launches?if so make sure you dont have spaces etc.. in the name of you custom site column,CT etc...(NOt Display name)
  2. Have you removed/include SP.js etc file from you webpage?
  3. coz that can cause you not to get your client context.

create an empty app and see if it works. And as pointed out above, try a sphosted app.it will clear out config problems from SP.

0

There are different types of Apps.

Provider hosted apps don't get an app-web. Your job is to host these apps and you can register them for high-trust code. This allows apps to execute client side code with only the app principal. Registering them works slightly different for onPrem and for SPO (O365). You have the option to use Server to server trust in them for "permission elevation" and do stuff that the user cant do.

There are also SharePoint hosted Apps. These apps cant execute server side code and are based on JS. You get your own App-Web and can use that to store data and work with it. Since this is pure client side code, it would not be smart to implement a S2S trust here. You need to send the data to the client to execute after all.

Have a look here:

https://blogs.msdn.microsoft.com/russmax/2014/06/23/part-1-intro-to-provider-hosted-apps-setup-the-infrastructure/

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.