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!

Related Articles

0 comments:

Post a Comment