Monday, 11 May 2015

Office365 Advanced Remote Provisioning Automation

Referring to my old post http://www.sharepointtweaks.com/2015/02/office365-automation-provision-lists.html, in which I adopted the Remote event receiver and CSOM to create SharePoint Artifacts in the host web via declarative XML. I've added couple of additional functionalists which enables the users to create custom user actions and Upload files via declarative XML.

When you think about it, why we need to bear all this difficulties to do simple provisioning steps within the AppContext. In a matter of fact, It would be nice if Visual Studio Team will add new Project Item templates to the apps for SharePoint project template which rapid the development of cloud-based SharePoint "Add-ins".

But until Microsoft grants the SharePoint Dev community the privilege I decided to enhance the automation of the remote provisioning to have minimal coding effort, and here is what I did to have an absolute zero-coding provisioning app.

  1. I exported my app (which I used to provision lists/files and ScriptLink custom action in the Video Portal extension post here) as Visual Studio project Template
  2. Remember to uncheck the Automatically import the template into Visual studio
  3. Create new Visual Studio Extensiblility project
  4. Type the AddIn information such as the Author/Product Name
  5. Configure Install Targets (Which visual studio version and how it will be installed)
  6. Copy the previously generated Project template the the VSIX project folder.
  7. Add the template by modifying the source.extension.vsixmanifest asset tab and Add new Asset
The above steps will ensure that the web project we used to deploy SharePoint artifacts to hostWeb will be created what we need to do now is a mechanism that will offer an alternative of the default behavior of the SharePoint Project when creating a new remote event receiver.

What is the default behavior ?

In any SharePoint App project if you update any of the Apps for SharePoint events properties Visual Studio will pop up a dialog box letting you know that an additional project will be created to host the logic of the App events receiver.


What is proposed change ?

I decided to add a visual studio extension which is simply new project menu item I will name it "Remote Provisioning" which will be used to create a remote event receiver web app project from the previously generated template.Means, any time the developer will right click a newly created vanilla SharePoint App he will be able to have a remote event receiver web app which he can use to deploy SharePoint Artifacts using declarative XML. Which means no code required

How it has been Implemented ?

  1. Add a new Class Library Project to your solution
  2. Add the necessary references to the Class library project
  3. Add new Class which Implements the the Interface ISharePointProjectExtension
  4. In the Class add the necessary code to create the project item menu and the menu item action
  5. Add the Solution to the vsixmanifest File Assets by Adding new asset of Mef Component Type
  6. Build the VSIX solution and now you will have the VSIX file which you can use to deploy the extension to Visual Studio for everyone in your development team


Happy SharePointing!

Sunday, 10 May 2015

Office365 (Video Portal) Enhancing The Channel Listing Page Experience

If you are not familiar with the Office365 Video Portal please refer to the blog post here in which I tried to introduce the video portal and explained  how to check whether it has been activated for your Office365 Tenant or not.

The Office Video Portal Video Player page is responsive "finally" and by taking a quick look at the office road-map website, we can tell that Microsoft is intending to make the whole portal fully responsive.

The Current Channel Listing Page 

But by looking at the channel listing page located at https://{your_root_SiteCollection}/portals/hub/_layouts/15/videochannels.aspx I felt it’s very basic page and gives very limited Channel informationThe limitation comes not only from the Information Architecture point of view, but also the way the channels have been rendered. 


The user can easily add a channel from the top right button “Add Channel” which allows him/her to name the channel and choose a color for the channel. That’s it! 


The user can’t add classify a channel based on categories or taxonomy or even add a channel description which is very frustrating. By taking a deep dive into the Video RESTful APIs I was shocked when I found out that Channel description field was retrieved for the get channels call /_api/VideoService/Channels 


So the field was already added to the information architecture and there is no way to update it from the Video Portal interface as the user adding a new channels! Why? I really can’t find an answer to that particular question!

How to provide a better user experience to render the Video Channels? 

First, I will create a new SharePoint Hosted App with a remote event receiver; the remote event receiver is used to handle the remote provisioning and it will add the following artifacts to the hub site collection as the app added to the hub site collection:
  1. Custom Channels Metadata List (extending the Channel Information architecture) 
  1. Custom Style List (contains all custom StyleSheets,JavaScript files and images
  1. Image Library (store the Channel Images)
  1. Custom user action to register a javascript File named VideoChannelsListing.js  (To override the OTB rendering for the Channels)
After adding the SharePoint hosted app "VideoChannelList" to the video hub SiteCollection we can see the above artifacts added successfully.

  
The Video Channel metadata list will hold the channel extended IA; it will use the channel ID to link between the channels (site collections) and the VideoChannelsMetadata List Items. 

All the needed styles and javascript files will be added to VideoChannelStyle library, if we install the app successfully it will render the channels as below 

Notice that only the channel name appears when the user hover the channel image, the user can easily go to VideoChannelsMetadata list and update the channels data by adding a row to the list. 
In this case I will change the sport channels data to be 


And below how the channel is rendered in the OTB videochannels.aspx page 


Happy SharePointing !