locked
Provisioning colums, contenttypes, lists and lookups in SharePoint hosted app RRS feed

  • Question

  • Hi,

    We're currently developing a SharePoint hosted app for a client. We are (declaratively) deploying some site columns (some of them are lookups), content types and list definitions to the appweb. Based on these list definitions some list instances are created.

    Initially this goes well. Lookups are correctly bound to the lists and when inserting list items through the UI the lookups are containing the right values.

    Problems are occurring when we try to update the app to a new version. After deploying the new app package and clicking update for the app, the app updates, but then all lookups are unbounded and UI shows no choices anymore.

    As an alternative we've moved away from declarative approach, and implemented the AppInstalled event in a Remote Event Receiver. In this receiver we're creating the site columns, content types and lists. Also we bind the lookup colums after the lists are created. This all goes well the first time.

    When we uninstall the app, and install the same app again (or retract/install from Visual Studio when debugging) the app installs again, and the event handler kicks in for the AppInstalled event. Strange thing is that the site columns we're trying to create are still existing in the appweb, though I assume the appweb is deleted and recreated when uninstalling/installing the app.

    When uninstalling an app, and installing it again, I see the URL change from (for example):

    https://mysharepointsite-5a125a2cd89415.sharepoint.com/site/mynewapp/

    to

    https://mysharepointsite-5a125a2cd89416.sharepoint.com/site/mynewapp/

    So the hexadecimal value is changing, so I assume this is a new web which should have no columns yet.

    As a result of this, the lookup columns are still pointing to invalid list id's and thus are empty. Updating these fields is not possible, lookups can only be set once.

    My question is, is this normal behavior, and if yes, how can we work around these issues? I want to start with a clean slate everytime I install an app.

    Hope someone can shed some light on this.

    Thursday, December 4, 2014 2:50 PM

Answers

  • Hi,

    According to your description, the Lookup columns in your app become unbounded after upgraded.

    As this is an unexpected behavior after app upgrade, to find out the root cause of this issue, I suggest you create a simple app contains only one Lookup column which bind to a list, deploy and upgrade it to see if the issue still exists.

    If it works, then you can add other Lookup columns and components into it and publish a new version one after one.

    By doing this, we may get more information about what will cause the issue.

    Feel free to reply if there any progress

    Thanks

    Patrick Liang

    Forum Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com


    Patrick Liang
    TechNet Community Support

    • Marked as answer by Dennis Guo Friday, December 12, 2014 9:39 AM
    Friday, December 5, 2014 8:27 AM