locked
using data sources on host web - RRS feed

  • Question

  • hi,

    during development can you use lists on the host web for lookup data ?

    or do you have to replicate everything into the developer site ?

    you can add multiple data sources - one connected to the host web and one connected to lists on the developer site without issue, but if you run the app, it deploys fine, however if you try and access a screen that contains the host web list data it blows with a big red error saying "request error"

    Thx

    MrP

    Tuesday, February 24, 2015 8:02 PM

Answers

  • MrP,

    I understand.  As long as these two sites collections are in the same tenancy (if not you're out of luck), then you need to provide tenant permissions to the sharepoint app. 

    First, reverse the change to web.config  (set the proper conn string back to your first url)

    Then, allow tenant permission like so:

    In SharePoint project, open AppManifest.xml and change permissions to Tenant: Write (image shows Tenant:Manage)

    HTH,

    Josh

    • Marked as answer by mrP Wednesday, February 25, 2015 8:06 PM
    Wednesday, February 25, 2015 7:52 PM

All replies

  • but if you run the app, it deploys fine, however if you try and access a screen that contains the host web list data it blows with a big red error saying "request error"

    HI MrP,

    As I know, we can use the same data source (list) as a lookup list in multiple fields.

    For this issue, LightSwitch’s Diagnostics subsystem is a lot more powerful than just telling you what exception was thrown when issuing a query.  You can use it to trace through the actions that were requested of the server, and what steps the server took in response to each action.  So even if things seem to be working, you can get more information about what your application was actually doing. More information: http://blogs.msdn.com/b/lightswitch/archive/2011/09/20/diagnosing-problems-in-a-deployed-lightswitch-application-eric-erhardt.aspx 



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, February 25, 2015 1:35 PM
  • MrP,

    There is an undocumented {HostWeb} token that you can use in your connection string. 

    Open web.config and find your connection strings.  Most likely there are two conn strings - one containing the {AppWeb} Token and the other containing the full URL of your HostWeb.  Replace the domain portion of this URL with {HostWeb} then deploy your app.

    HTH,

    Josh

    • Marked as answer by mrP Wednesday, February 25, 2015 7:03 PM
    • Unmarked as answer by mrP Wednesday, February 25, 2015 7:14 PM
    Wednesday, February 25, 2015 1:57 PM
  • will that work for when debugging the app ?

    we are using a developer site on office 365 - will that make a difference?

    thx

    MrP

    Wednesday, February 25, 2015 3:33 PM
  • Yes, it will work when debugging and on O365.
    Wednesday, February 25, 2015 3:36 PM
  • mmh,

    my web config was already using {HostWeb} for one connection string,

    I replaced the url in the other with it as well and hey presto, it works!

    I do not see a reference to {AppWeb} anywhere.

    Thx

    MrP

    Wednesday, February 25, 2015 7:03 PM
  • Josh's suggestion simply stops the error occurring, i get no items shown for all my lookup lists.

    any other ideas?

    Wednesday, February 25, 2015 7:15 PM
  • > I do not see a reference to {AppWeb} anywhere.

    Right.  I had it backwards.  {HostWeb} will be there, but {AppWeb} will not. 

    {AppWeb} is good for lists that get provisioned with the app  as they will be deployed on the AppWeb rather than HostWeb.

    Glad it worked for you.

    Josh

    Wednesday, February 25, 2015 7:15 PM
  • The HostWeb depends on where you're deploying your app.  For example, if you test it on a dev site:

    https://dev.sharepoint.com/sites/apps then that is the host web.  But if you later deploy to

    https://somethingelse.sharepoint.com/sites/anothersitecollection now that is the host web and any dependent lists and list items need to be deployed on that site too.

    My guess is you are testing in a different site than your are deploying and the lists on the deployed site are empty.

    HTH,

    Josh

    Wednesday, February 25, 2015 7:20 PM
  • we have the production lookup data in lists at this address

    https://<client>.sharepoint.com  

    we have the developer site as a sub site of that site at 

    https://<client>.sharepoint.com/sites/devsite -- this is the host web ? 

    when developing/debugging we want the lookup data on the first url to be accessible to the app running in the developer site ( so the list s are not in the host web but the parent of the host web).

    MrP

     

    Wednesday, February 25, 2015 7:33 PM
  • MrP,

    I understand.  As long as these two sites collections are in the same tenancy (if not you're out of luck), then you need to provide tenant permissions to the sharepoint app. 

    First, reverse the change to web.config  (set the proper conn string back to your first url)

    Then, allow tenant permission like so:

    In SharePoint project, open AppManifest.xml and change permissions to Tenant: Write (image shows Tenant:Manage)

    HTH,

    Josh

    • Marked as answer by mrP Wednesday, February 25, 2015 8:06 PM
    Wednesday, February 25, 2015 7:52 PM
  • bingo, :)

    thank you , and thanks for the near email response times :)

    Wednesday, February 25, 2015 8:06 PM