Showing posts with label 0365. Show all posts
Showing posts with label 0365. Show all posts

Monday, October 6, 2014

Deploying Lists and Adding new lists via features

Hi Readers,

This post will give you information on deploying lists , making changes to the lists and adding new lists to the Sharepoint site in O365 or on premise.

What we are using here is feature upgrades, its simple and fast also Sharepoint manages most of the work.

Lets go step by step

First create a project and add a list

Add a new column and name it description



Now from the solution explorer open "Feature1" this will be the feature which we'll be using to deploy and update our lists


 Now press F4 or open the properties pane and give a version to the feature, as its the first deployment I've put version 1.0.0.0

Now package the WSP and upload it the the solution gallery, you can get to solution gallery by going to "Site settings -> Solutions" , and activate the solution.

Now go to site features from site settings and you can view the feature that we have deployed, activate it.



Now our list will be created.


As we have deployed the list, lets see how we can upgrade it, for this I'm going to add a new column to the list,that is called SubTitle

Now open the feature1 again and give it a new version number "2.0.0.0"

Providing a new version number will not update it, we'll have to edit the feature's manifest to do this,
First open feature1 and move to the manifest tab.

 At the bottom you'll see a link saying "Overwrite generated xml file", now you'll see the screen below click the "Edit manifest in the xml editor"

Click that and you'll see the manifest of the feature, the manifest will look like this

Now we'll have to edit the manifest and add upgrade actions to it, here we are asking sharepoint to apply the element manifest if the version is greater than 2.0.0.0.


Now package the WSP.
Here we'll have to do another step before deploying , that is rename the file, then only sharepoint will ask to upgrade it.

Upload the new file and it'll ask you to upgrade the solution. click upgrade.

 Now you can see that the newer version is activated.


 If you go to your list it'll be updated and the new column will be there.


Now we'll see how to add a new library to our feature.
Add a new list and select the type as library


Now you'll see that a new feature is added to your solution, you may delete it, because its not required.


Open the feature again but this time we'll need to go the edit manifest screen and copy the upgrade actions we did in the last part,
Keep it safe in a notepad.

And click the "Discard manifest edits..." and now you can add the new library to the feature using the UI.

Again go to manifest tab and go to XML editor , here we'll have to update the version number and add new upgrade actions, you can see the edits that are done to the xml file. Also the version is increased as well.


You may create the wsp and upgrade the solution but the list will not be created.


If you increase the version again and deploy n upgrade the solution , the list will be created.


You can see that the latest version is activated.

And now your library is created.
You can use this technique to update lists and add new lists, any site that is having this feature will be upgraded and the new lists will be created.

Happy Coding
-Guruparan Giritharan-

Monday, June 2, 2014

Upgradable Sharepoint Webtemplates - Introduction

Hi Readers,

This post is about creating web templates that are upgradable, the method I'm using here is using several features to upgrade the site template.

Let's see the requirement for this, think that your client has a requirement for creating a team site which has a template that is different from the out of the box team site, this may include the contents of the site or even the structure of the site. Your client may ask for a set of lists and libraries that are to be created when a new site is created and the site may have pages that are to be created and webparts are to be placed at those pages.

It may sound simple and you may think that creating a simple site and saving the web template will do the trick, well at some times it will but what if your client comes up with a new library to be added to all the site that are created ?.

Of course you can create a new template after adding the new library, then what happens to all the sites that are already created ?, you may go to each and every site and create the library, what if there are hundreds of sites created ? , will it be practical to go to each site and add the library the answer is No because nobody is ready to do a task like this, You may of course use powershell script or a simple console application to do this but even that may not be possible in production environments.

So lets go to the solution, that is creating a web template and using several features to deploy the content and structure by doing this you can simply update the sites that are created and the site are to be created in the future.

This blog post series will have three more posts
1. Updating lists, adding lists
2. Updating webparts
3. Updating Webpart pages

The concept behind this is Feature Updating and all this is done using sandboxed solutions because it will work in Sharepoint Online as well.
I'm going to create 3 different features and show how to update them, when you create the site you can simply activate them and create a template from it and by upgrading the features you can simply update the sites.

Only problem you may face here is activating a new feature to existing sites, that of course will have to be done using the powershell.

Hope you find this post useful.
-Guruparan-