Skip to main content

SharePoint hosted App Upgrade

Preface: This post was written a long back, but somehow it was never published and was kept in draft mode (may be, I forgot). There might be a new update process published by MS. I'm still publishing this post just to share my learning. Do google/bing for latest information on App Update.



When I was playing around SharePoint Hosted App on SharePoint Online, I observed a couple of behaviors with respect to App upgrade. So I decided to post my observations here.

Scenario:
I've created a simple SharePoint Hosted App. This app has a Client Web Part. This Client Web Part reads items from a List. This List is created in host web.

Deployment steps followed:
  1. Package my solution in Visual Studio.
  2. Upload .app file to App Catalog in my SharePoint Online tenant.
  3. In my team site collection, add this App from "From your Organization" page.
  4. After adding App, navigate to any page, edit the page and Insert Client Web Part (available under App Part).

My Observations:

Case 1 - App Version 1.0.0.0
In this version, I'm reading top 1 item from the List. After I deploy (refer above steps) and when I refresh the page, Client Web Part is showing only one item from the List.

Case 2 - App Version 1.0.0.0
Though version is same, I modified my code to pull top 2 items from the List and I deploy this app. In my team site, Client Web Part still shows only one item and when I go to About page of my SharePoint Hosted App, there is no message that my App has changed.
So, if you change any logic in your app keeping the version number intact, it will not affect on the sites where it is already added. Also, site user will not come to know about any changes in the App.

Case 3 - App Version 1.0.0.1
I changed the "Revision" part of version number. I changed the code to read top 3 items from the List and deployed. Now here is the interesting part.

When you go to the page where Client Web Part is added, it still shows only one item. However, when you click on About link in App under Site Contents as shown below



About Link

it shows that "there is a new version of this app. Get it now".

Upgrade Option

When you click on Get It button, it prompts you to trust it.
Trust It
When you trust it, upgrade starts.
Upgrade

Now if you go to the page where Client Web Part is added, this web part shows 3 items from the list.

Summary:
  • If you are making any changes to the existing App, ensure that Version is changed.
  • If Version is not changed, the changes will not reflect unless user removes the App and adds again. However note that, Client Web Part also gets removed from the page.
  • In this scenario, site user need to decide to go for App upgrade.

Comments

  1. Hi Suresh,

    There are certain doubts I have regarding your post here

    If you are deploying through App Catalog, it will not allow you to keep the same revision number. So I am curious to know if there is any exception to this.

    Also I want to know what will be the behavior of the App while it is upgrading. Will the end user see a service unavailable page similar to SharePoint Server side upgrades or will it be different.

    ReplyDelete
    Replies
    1. As I have mentioned in the post, I tried this long back. I could able to deploy to App Catalog without changing revision number. I am not sure if it has changed now. I will try and let you know.

      Second one is a great question. I have not checked this perticular scenario. Will keep this in mind when I am testing. Also do let me know if you get any findings on this.

      Delete
    2. Your app will show a message that the app is under upgrade

      Delete
    3. Thanks @Anonymous for the reply.

      Delete

Post a Comment

Popular posts from this blog

All about SharePoint List View Styles

Sometimes, there are out of the box features which we tend to ignore and later when we do apply, we are more than happy about the feature which is readily available in SharePoint. One such feature is List View Style. I never thought I would write a post on this. However, whenever I spoke about this with users, people were excited to see the result. That prompted me to write this post. Instead of getting into only theory part, I will basically take use cases where these styles can be applied and also touch up on on some minor limitations with certain style. When you are creating/modifying a List view, you will get an option to select View Style. As shown below, there are 8 options available and Default is always set if you ignore this style. List of View Styles I will take typical Contact List and Announcement List to explian about these styles. Let us go one by one. Default: This view, as name suggest, is the default style in a view. This is one of the widely seen style ...

How to update Person field with multiple values using REST API

Person or Group field in SharePoint is similar to a Lookup field. When you are updating this field using REST API, you need to append "Id" to the name of the column in the body construct. For example, the body construct looks like this: data: { "__metadata": { "type": "SP.Data. ListName ListItem" }, "Title": "First Item", " PeopleField Id": "4" }; The highlighted portions should be replaced by the actual List Name and Column Name. In the above example, the REST call is updating a List item with Title and People columns. How to get the value for user ID ("4" in the above example) needs a separate explanation and that will be my next post! The above example works fine if Person field is configured to accept only one value. If we change the Person field to accept multiple values, how do we pass more than one value in the REST call? Since we normally separate user names with semicolon in peop...

How to get SharePoint List or Library GUID via REST

Sometimes, you would need List or Library GUID to use that in some operation. In such cases, how do you get hold of GUID using REST API? There is a straight-forward end point which you can use: /_api/web/lists/getByTitle('ListTitle')/Id This will return the GUID of a List or Library. There is also another approach. However this approach works only if a List or Library contains at least one item. /_api/web/lists/getByTitle('ListTitle')/items This is a familiar end point which we use to fetch items of a List or Library. To get the GUID from the response, you would do: var listIDTemp = response.data.d.results[0].__metadata.id; var listID = listIDTemp.substring(listIDTemp.lastIndexOf("guid") + 5).split('\'')[0]; As you can see, we are doing string operations to fetch GUID from metadata.id. This contains information only if the response has at least one item.