CHUVASH.eu

CHunky Universe of Vigourous Astonishing SHarepoint :)

Tag Archives: EF

Provisioning Google Maps JSLink with SPMeta2

kartta-000

Among PnP Samples there is a solution for using Google Maps. Great solution where where you can pick a point on a map and define a spacial area on the map. Unfortunately it is a sandbox solution. I rewrote it to a code based template with SPMeta2 Framework. Now it can be installed on any site very easily, without needing UserCode Service and a cumbersome process of uploading a wsp package and activating it. The code is very simple, you can see it on github.

kartta-001

Let’s take a look at it. It does not contain a single line of SharePoint Legacy XML. There are following SharePoint artefacts that are getting provisioned:

  1. Two site columns (Location Point and Location Area)
  2. A SharePoint List (Locations) with two additional fields mentioned above
  3. Google Maps code in and CSR in a jslink file
  4. Auxiliary pages for selecting points and areas on the map.

Field Definitions

In SPMeta2 everything is separated in meaningful definitions. First we define our fields. The preferred place in the VS solution is Definitions – IA – Fields.

kartta-002

List Definitions

Then we define our List – Locations. That is also a SPMeta2 Definition. List Definitions reside in Definitions – IA – Lists. We do not add fields in our list definition. The fields are added while “assembling” the model.

kartta-003

ListView Definitions

ListView Definitions are also in the Definitions – IA folder. We inherit from the OOB AllItems view:

kartta-004

Modules (a.k.a. Files)

Resource files like javascript, css, aspx, html and so on are Modules. They are in the “Modules – Implicit” folder. The internal structure is copied to the web folder. The upload of files is easy and is defined in the web model, see next section.

Web Model

Now it is time to pick the definitions and create a model. The most common model is a Web Model. The model is created programmatically and relies on “Add” methods: AddField, AddList and so on:

kartta-005

Provisioning

The actual provisioning is the most fun, it is easy and straight forward, it takes models and deploys it to a SharePoint site. You can easily switch between SSOM and CSOM.

kartta-006

Distribution

Another bonus of SPMeta2 Provisioning Framework is the ability to serialize and deserialize models to XML or JSON. In our project we define SharePoint Applications as SPMeta2 models serialized in XML and make them available for installation on any SharePoint Site.  A SharePoint Application is a meaningful collection of SharePoint artefacts that becomes an entity and solves a business need.

Summary

This Maps solution is a simple solution, but it is a very powerful one, originally created by the PnP team. If we just redesign the Provisioning Part, it becomes awesome. SPMeta2 provides a solid, well defined, easy-to-understand framework for define code-first models for SharePoint Applications.

Trying out Visual Studio Code on Ubuntu

I am very curious about the new .NET Core, ASP.NET 5, EF 7 and Visual Studio Code for Linux, Mac and Windows. I have tried it out on an Ubuntu 15.04 machine. The installation and configuration required a few steps, so it is not an usual “Next-next-next”-installation. But, hey, it is just a beta, a preview so far, and first of all: It worked. I am sharing a couple of screenshots and the commands I ran in the terminal, mixed with comments and links:

 

Selection_003

Selection_004

Selection_005

#install latest node and npm
#https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g yo
sudo npm install -g generator-aspnet
# download VS Code and make a link
# make a folder
mkdir workspace/tryvs
cd workspace/tryvs
# create "src/global.json" file:
# http://docs.asp.net/en/latest/tutorials/your-first-mac-aspnet.html
{
  "sdk": {
    "version": "1.0.0-beta7"
  }
}
nano src/global.json
# start VS Code 
# create 
# install omnisharp:
# http://docs.asp.net/en/latest/getting-started/installing-on-linux.html#installing-on-debian-ubuntu-and-derivatives
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
dnvm
#install dnx
sudo apt-get install -y libunwind8 gettext libssl-dev libcurl3-dev zlib1g libicu-dev
dnvm upgrade -r coreclr
cd EmptyApplication
dnu restore

#install libuv
#http://docs.asp.net/en/latest/getting-started/installing-on-linux.html#using-docker
sudo apt-get install make automake libtool curl
curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | sudo tar zxfv - -C /usr/local/src
cd /usr/local/src/libuv-1.4.2
sudo sh autogen.sh
sudo ./configure
sudo make
sudo make install
sudo rm -rf /usr/local/src/libuv-1.4.2 && cd ~/
sudo ldconfig

#build, I got an error here
dnu build

#start the web server
dnx web
Discovering SharePoint

And having fun doing it

Bram de Jager talking Office 365, SharePoint and Azure

My view and thoughts on Productivity and more.

My programming life

and everything in between

SharePoint Development Lab by @avishnyakov

It is a good place to share some SharePoint stories and development practices.

SharePoint Dragons

Nikander & Margriet on SharePoint

RealActivity - Real-time and trustworthy

Blog site of founder, RealActivty - Paul J. Swider

Mai Omar Desouki - Avid SharePointer

Egyptian & Vodafoner - Senior SharePoint Consultant

Cameron Dwyer | Office 365, SharePoint, Outlook, OnePlace Solutions

Office 365, SharePoint, OnePlace Solutions & Life's Other Little Wonders

paul.tavares

Me and My doings!

Share SharePoint Points!!

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén

SPJoel

SharePoint for everyone

SharePointRyan

Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode, ya mama

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint

blksthl

Mostly what I know about SharePoint - CommunicoCuspis