Error occurred in deployment step ‘Install app for SharePoint’: SideLoading of apps is not enabled on this site

In order to publish a SharePoint hosted app to a site collection the site must be based on the developer site template or have the “Developer” Feature enabled on it.  The “Developer” Feature is marked as hidden in its definition so you must use PowerShell to enable the Feature. This error is caused when you try to deploy in a non-developer template site collection.

To avoid this error, either for SharePoint online or On-premise development, try first to create a site collection based on the Developer template and deploy your SharePoint-hosted app to this site collection. If you are deploying to a non-developer template site collection, which is something you shouldn’t be doing then here are the live links to download the SharePoint Online Management Shell i.e. for SharePoint online scenario and associated PowerShell scripts as described in the screenshot below:

side-loading

Hello world SharePoint-hosted app

As indicated in my last blog post, I am running the Apps for Office sample packs so that I can learn some their techniques. The following is what I had to do to run the “Hello world  SharePoint-hosted” app and the result I got.

  1. I run the above app by using Visual Studio 2013 update 3
  2. Below is how the file looks like under the solution explorer. Make the necessary changes as suggested below and run it.

hello-sp-hosted-app

 

3. You will immediately be asked for Office 365 user name/password and later you see the “Do you trust Basic SharePoint-hosted?” app page as follows

trus

4. Click Trust It button and you will see this result page

resultThere was some warning while I deploy the app because the CDN url for jquery as was set as http not https. Change it to https and that will take care off the error.

Another note, is that as you uninstall and install the same app the GUID for appweb  appears to remain the same except the last letter in the GUID part changing sequentially up. 

If you go to my Office 365 tenant home page, https://sharepointcan.sharepoint.com, you see a link for the new SharePoint-hosted app listed under the Recent left navigation menu as well as created within the Apps in Testing custom list. The latter custom list captures the list of apps under test as well as their appweb url.

result2

If you want to refer as to how this app is created please check the how to create a basic SharePoint-hosted app.

Now, I would like to deploy the app so that my users can start using it. How do I go about it. First make sure you deploy the app from VS 2013. Next we need to find a place where we can store the app. Options are either to SharePoint public store or your own organizational app catalog. I will create an app catalog by going into my Office 365 SharePoint Admin center. Check this how to deploying and installing apps for SharePoint: methods and options.

appcat

Go to your App catalog site collection and upload the .app file into the Apps for SharePoint document library.

app-location How to add an app

Go to any site where you would like to add this app (and a copy of the same app is not yet avilable) by clicking the gear icon a.k.a. site actions -> Add an app -> Click From Your Organization, from the left nav -> click the app -> Click Trust It button.

This will add the app into your site. When you click this newly created app, it send you to a different domain, as explained above, but same SP chrome setting.

That is it.

My approach for mastering SharePoint 2013 apps development

SharePoint development in the 2013 version has drastically changed leaving us to scratch our head as there is a lot to learn to catch up with the best process/technique of developing SharePoint apps. To make matter worst, Microsoft is push enterprise SharePoint development from on-premise to Office 365. Meaning we need not to forget the old way of writing trusted, server-side code, solutions as well as the new/future way of writing client-side code or apps in short. Having said that this blog post only refers to the latter SharePoint development scenario, which is creating SharePoint apps. The following is how I mapped my learning process. If you have a different one please let me know.

  1. Sign up for Office 365 environment and install Visual Studio 2013 update 3 in your local dev machine – done
  2. Signup for Azure as the provider hosted app that you develop will require you to have a  website where you would deploy your custom code – done
  3. Set up on-premise SharePoint 2013 development environment by forking at least a 16 GB memory laptop, which can be very expensive but effective – done
  4. Install Apps for Office sample packs as well as Office Dev Github projects and start playing with the code. I preferred to run these codes in my Office 365 tenant so that it would be much faster to start the work – in progress
  5. First plan is to master SharePoint-hosted apps development and later move into provider-hosted apps.
  6. Learn JavaScript frameworks such as jQuery and Angular JS as they can be valuable tools in the SharePoint-hosted apps development life cycle.

In the next blog post I will share some of the experiences I got in my learning endeavor.

Exported SharePoint list templates not retaining lookup column data

This post is based on Gitolekha’s blog post with added explanations and tool-set especially for finding list GUIDs and how you can alternatively convert cab files to stp files.

I have a parent list called Tracking and a child list called Org i.e. in the source site. My parent list, Tracking has a lookup column called orgcode. A child list called Org has the column orgcode.

I have several data already populated in the parent list. I was asked to migrate the Tracking list with its data from its current location to a diffrent site/could be a different farm or web application. The client do not want any data loss.

You might think saving the Tracking list as template with data will do the trick. Unfortunately, saving the Tracking list as template with data and exporting it into your destination site will only have partial data. That means lookup column data gets lost in the process. This problem occurs because list template does look up on a table using GUID. In creating a list  template and exporting to a different site this GUID changes, hence it is no longer able to retain the values.

This is how I tackled this issue:

  1. Save the child list, Org, as template i.e. with data.
  2. Add this list template into your destination’s list template gallery library. Its url is http://your site/sites/[site collection name]/_catalogs/lt/Forms/AllItems.aspx.
  3. Create a new list called Org, in your destination site, based on the Org list tempalte that you created in step #2.
  4. Find the guid of the newly created, Org, list using this wonderful utility tool.(http://weblogs.asp.net/soever/sharepoint-development-handy-little-utility-to-get-guid-s-and-attribute-names).
  5. Go to your source site and find the guid of the Org list from the Source site using the same utility tool.
  6. Go to your source site and save the Tracking list with data as template. This will create a file with .stp extension. Have a copy of this file into your working folder.
  7. Go to the folder where you saved the Tracking list template i.e. the .stp file and rename the file extension into .cab.
  8. Double click this .cab file.
  9. Right click the manifest.xml file and extract it by selecting your working folder.
  10. Now open the extracted manifest.xml file and look for the child list’s source guid as captured in step #5
  11. Replace source child list’s guid with destination child list’s guid as captured in step #4.
  12. Now convert your edited manifest.xml cabinet file into stp file using makecab.exe as follows.
  13. Run your command prompt tool -> go to the folder where the edited manifest.xml is located and run the next command line
  14. … makecab.exe manifest.xml NewTrackingList.stp

makecab

Now import the edited stp file i.e. NewTrackingList.stp into your destinatiion site and create a new list instance. If you check your newly created parent list, you will see all column data intact with lookup column included.

How to upgrade a Visual Studio SharePoint 2010 Branding project

The assumption is that you deployed your branding solution as .wsp file and you now wanted to make further changes such as the master page, page layout, CSS, images etc..
How do you go about the upgrade and deployment process:

  1. Open your existing branding solution using Visual Studio 2010 or latest version
  2.  Make the appropriate code changes
  3. Save your project and later, right click your solution and  “Rebuild”
  4. Right click your solution and click “Package”
  5. Right click your solution and click “Open Folder in Windows Explorer”
  6. Click the bin folder
  7. Click Debug folder
  8. Make sure your .dll, .pdb and .wsp files’ modified date is todays date to reflect that you indeed have rebuilt the project
  9. Make a copy of the wsp file, rename it such as by giving a version number
  10. Since this is a Sandboxed solution, to deploy click Site Actions -> Site Settings -> Solutions (i.e. under Galleries)
  11. From Solutions page, click the Solutioms ribon and later Upload Soltuion icon.
  12. Upload the renamed .wsp file and in the Solution Gallery – Upgrade Soltuion dial box click the Upgrade icon
  13. As you can see your new .wsp file is activated while the previous .wsp file is deactivated

That is it.

How to shrink SQL server 2008 R2 database in a dev environment

I am writing this tips as a note to myself.

As a SharePoint developer I run my SharePoint 2010 development inside a VM. As times goes by I found myself short of hard disk spaces. Following these steps helped to alleviate the problem:

  1. Open up your SQL database where SharePoint is installed
  2. Find the database where its log file is taking up lots of space, in most situations it would be Sharepoint_Config.
  3. Right click the database -> Properties -> options and now change recovery mode from full to simple
  4. Right click database again -> Tasks -> shrink -> database then click Ok. This will shrink the SharePoint_Config_log.ldf file
  5. Finally change the recovery mode to full by following a similar step as #3

Please do not use this technique in prod environment as you normally would require to have a normal database backup process.

Building Dynamic BI Using Excel/SharePoint List Data – part 2

Since in Microsoft Office Excel 2007, the ability to synchronize data between Excel table and a SharePoint list is deprecated we need to download and install an add-in. The add-in then will enable us to update the information in a SharePoint list from Excel 2007.

The first thing we need to do is download and install the Excel 2007 Add-in: Synchronizing Tables with SharePoint Lists into our Microsoft Office 2007 client application.

Please consult this MSDN paper as to how you can install the add-in into Office 2007 and publish the data to a SharePoint list.

Please note that you cannot save your Excel workbook in the new Office Open XML Formats (.docx). Instead, to retain the functionality, you need to save the workbook in the Excel 97-2003 file format (.doc).

If you follow these steps you have now an Excel workbook that has a data and synced to a SharePoint list.

In my next and final blog I will explain as to how we can create the Visifire chart, to display the synced SharePoint list data, using SharePoint designer 2007.

enjoy