10

I am little bit confused here and looking for some advise. What I know:

  1. When we install SharePoint hosted app it will be installed in your host web as a sub-site within a site collection which is called as app web.

  2. Host web and App web will be on a different domain which is base of app model.

  3. Host web URL - https://www.fabrikam.com/sites/Marketing App web URL - http://app-bdf2016ea7dacb.fabrikamapps.com/sites/Marketing/Scheduler

  4. Host web has a one custom list say "Issues and Findings"

Now, To access list item I can browse to below URL which is expected https://www.fabrikam.com/sites/Marketing/_api/web/lists/.....

But, I am able to get same list item using http://app-bdf2016ea7dacb.fabrikamapps.com/sites/Marketing/_api/web/lists/.... as well.

Sure - I have given my app Full Control on the "List" scope and Trusted it.

Since, these are two different domains (app and host), I was not expecting 2nd Url to return same result as first one. Instead it should working only when specified as below ....<appwebUrl>/sites/marketing/_api/SP.AppContextSite(@target)/Web/.... @target = <hostweb>

Am I missing something here?

8

App Web - Site on which the App is deployed

Host Web - Site on which the App is installed

App web is in isolated domain but it is still inside the same site collection as host web. That is why your second request returned results.

Now if you want to query cross domain data, we need to follow the syntax you have mentioned. Because this call will happen from inside your App context.

  • 2
    "App web is in isolated domain but it is still inside the same site collection as host web". To be more specific, the App Web is in the same site collection and it is a child site of the Host Web – Rob Windsor May 12 '15 at 13:59
  • Thanks Rob and Amal for your responses. But custom list exists in site collection and not in child site and 2nd Url starts with appUrl., so we shouldnt get results back. May be I am still not getting it. :( threewill.com/sharepoint-2013-app-models-considered-part-2 – user12345 May 12 '15 at 14:10
  • For time being ignore the domain. You can see sites/Marketing is the location of where the list resides. Now add domain in front.. and you will get the list. You can test it by opening http://app-bdf2016ea7dacb.fabrikamapps.com/sites/Marketing/_layouts/viewlsts.aspx and https://www.fabrikam.com/sites/Marketing/_layouts/viewlsts.aspx – Amal Hashim May 12 '15 at 14:22

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.