Thursday, March 27, 2014

Creating List Definition and List Instance in Visual Studio 2012

This post may be seems to be simple for creating the List Definition,List Instance in SharePoint using Visual Studio 2010.

But definitely not when you are trying to implement using latest visual studio 2012 or 2013. Of course there are many instances to be created visually in VS 2012 but there you cannot find the "List Definition" project item as you were seen in VS2010.

To create the List Definition in VS 2012 or 2013 you need to select the "List" item template and select the "Create a customizable list template and list instance of it" and choose default (Custom List) as shown in the figure

else you will not get the List definition templates (List Instance, Element.xml, List template and its element.xml and Schema.xml).

Some points to note down here..Why should we need ? just consider you wanted to create the site definition with desired list (Feature Stapling - You will get two feature with site and web scoped from List definition template) and another scenario where you wanted to organize the SharePoint folders based on multiple layer.
Finally its helpful to develop the Model-View-Control (MVC) pattern based SharePoint application

Visual Studio 2013 simplifies the developer job by letting them to create the columns visually.In WSS 3.0 days It was so tedious job to manually creating the Field tag with multiple attributes and GUID for each fields.
The only simplest way is keeping the List Definitions Feature ID and ListInstance's Feature ID same

Now everything is just like that create all your columns and bind the content types in GUI as shown in the below screen.

Schema.xml file will be generated as you select columns and views from the above screen

List Definition Folder structure in SharePoint 2013

Friday, March 21, 2014

SharePoint App custom properties

This workaround is based on how to create the SharePoint hosted app using very basic level of "Twitter" widget.

How to prepare your twitter widget.
Login into your twitter account.
Click on the "Setting icon" in top of the right hand side.On pop up menu select the "Settings".
It will navigate to
On this page click the "Widget" on the "Configuration" select the desired settings such as height,width,theme,include replies and expand photos,based on this selection html tag and scripts will be generated.

Example : my twitter widget code to be placed on web page.

SharePoint hosted App with Custom Properties

Now create the SharePoint hosted app through visual studio 2012.
help link
All you need to do here is,add the "Client web part(hosted web).
Right click on the "SharePoint Project" ->Add New Item->Client WebPart (hosted web)
When you add you will be prompted to add this webpart in the existing page or in new page as shown in this picture.

Now go to your "WebPart's" Element.xml file and insert the properties like shown below.

Construct the content type xml node exactly same and see the Query value starts and ends with underscore.
Content Type="html" Src="~appWebUrl/Pages/TWP.aspx?TweetLimit=_TweetLimit_&theme=_theme_&IsReplyShow=_IsReplyShow_&" />

At run time you can change the number of tweets to be displayed and desired theme.

Download the code to learn more on  SharePoint app development

Source code.

       After this my App looks like this