Translate

Friday, August 24, 2012

New Features of SharePoint 15 or SharePoint 2013

SharePoint 2013 New Features


1. Improvements and new capabilities in SharePoint architecture includes
·         Improved in themes
·         Sharing
·         Request Management
·         Cache Service
2. Social networking
Now it allows micro blogging like follow people, site content and be able to share links and content
Improvement in Discussion Board, allows blog integration with client application.

3. Web Content Management
·         Allows cross site publishing
·         Metadata navigation
·         Search engine optimization
4. Search
·         New Search architecture
·         Now user is able to personalized search history result
5. Business Intelligence
Lot of improvements in BI
Enhancement in SharePoint Mobile like automatic mobile browser redirection , allows office mobile apps.

Thursday, August 23, 2012

Sharepoint 2010 Master Pages

Master Pages


In SharePoint  2010 Microsoft has provided different  types of master pages to make sure that application pages and site pages will have same look and feel.
There are 3 default master pages are provided by Microsoft

  1. Default.Master
  2. V4.Master
  3. Minimal.Master

There will be “Master Page Gallery” for each new site created in the SharePoint. The master pages support the changes/customization with the SharePoint designer.
Each master page includes such as breadcrumb, Ribbon, Welcome menu, Site Actions, Quick Launch and TopNav bar.


  1. Default.Master
It contains the standard HTML layout and chrome of a SharePoint 2007 site.It also supports sharepoint 2007 to sharepoint 2010 master page upgardtion.This master page is provisioned in Master Page Gallery for every new SharePoint 2010 site is default.master.

2.V4.Master
The v4.master page contains some basic HTML layout for a page, including standard elements
Such as form, html, head and body, and includes many server-side controls that are used to
encapsulate logic and user interface components into the Microsoft.SharePoint assembly

3. Minimal.Master
This master page is used by several of the standard site page templates and application pages; it does not options which are provided my v4.master.



SharePoint Application and Site Pages

SharePoint Application Pages

Application pages are type of page stored in the path “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS”.
Application pages are “.aspx” pages and it does not run in _layouts virtual directory, it does not allow customization; application page is very good in performance wise because the pages are being compiled in to “. dll”. Application page allows.

SharePoint Site Pages

Site pages are pages which are provided by SharePoint foundation example default.aspx, home.aspx, library.aspx and WebPart pages. These are the pages gets created when the SharePoint is installed.

Deference between Application pages and Site pages

S.No.
Site Page
Application Page
1
Site pages support page customization.
Does not support customization.
2
Example of site page is “default.aspx”.
Example of site page is “settings.aspx”.
3
Each customization is stored in content database.
Very good in performance wise.
4
It does not allow adding any inline code.
It allows inline code.
5
The customization can be done through SharePoint designer.
It cannot be.

Tuesday, August 21, 2012

SharePoint Content Types

Content Type

Content Types are the building blocks of site columns and content types defines the schema of the fields of list item ,Content types helps in reusing the site columns across the site collection, we can create content types and attach these

How to navigate Content Type page

Content types to site columns to create content type navigate to site settings page and click on site content types.

To view the list of available content types of a site collection you can directly navigate to the page "mngctype.aspx"

Content Type scope

Content types can be created based on site collection or inside child site of a site collection

The following shows the lists Ids associated with each type of list/templates of the list

Parent
Name
Id
Item
Document
0x0101
Item
Announcement
0x0104
Item
Task
0x0108
System
Item
0x01
Item
Link
0x0105
Item
Contact
0x0106
Item
Event
0x0102
Folder
Summary Task
0x012004
Document
Picture
0x010102
Folder
Discussion
0x012002
Document
Form
0x010101
Document
Wiki Page
0x010108
Document
Basic Page
0x010109
Document
Master Page
0x010105



Using AvailableContentTypes

If you want to know the avaible content type using code you can use "AvailableContentTypes" SPWeb site = SPContext.Current.Web; // iterate content types for current site and parent sites too foreach (SPContentType myctype in site.AvailableContentTypes) { }

Create content type programmatically

The following code demonstrate how to create content type programmatically

Sample code:
//access the web of the site collection
SPWeb site = SPContext.Current.Site.RootWeb;
//create content type name
string myctypeName = "hey my content test";
//access parent
SPContentType myctypeParent = site.ContentTypes["Item"];
//create content type
SPContentType myctype = new SPContentType(myctypeParent, site.ContentTypes, myctypeName);
//assigned the description and create a group
myctype.Description = "I am doing content type programatically";
myctype.Group = "My Content Type Group";
//Add to site collection
site.ContentTypes.Add(myctype);

Monday, August 20, 2012

Querying Multiple Lists using SPSiteDataQuery

SPSiteDataQuery



SPSiteDataQuery is used to query multiple lists and SPQuery fetches only from single list
Sample code demonstrate
a query that returns events from all calendars
in the current site collection where the end date is later than Current Date

Sample Code:

SPSiteDataQuery query = new SPSiteDataQuery;

query.Query = "<Where><Gt><FieldRef Name='EndDate'/>" +
"<Value Type='DateTime'><Today OffsetDays=\"-1\"/></Value></Gt>
</Where>";

query.Lists = "<Lists ServerTemplate='106' />";
query.ViewFields ="<FieldRef Name='Title' />" ;
query.Webs = @"<Webs Scope='SiteCollection' />";
DataTable table = SPContext.Current.Site.RootWeb.GetSiteData(query);


Working with CAML Queries and SPQuery

CAML Queries



In sharepoint if we want to retrieve the data from Lists we need to use CAML Queries
CAML stands for Collaberative application markup language,which is basically xml format language query style.

To query the list we need to use SPQuery object by creating new object and assigned the CAML query to SPQuery.Query

CAML Query operators

Operator                Description
And                 It will be used to combined the two or more conditions or multiple conditions
BeginsWith      Searches for a string at the beginning of the text field
Contains         Searches for a string within the text field
Eq                Equal to
FieldRef         A reference to a field (useful for GroupBy elements)
Geq              Greater than or equal to
GroupBy       Groups results by these fields
Gt                 Greater than
IsNotNull      Is not null (not empty)
IsNull            Is null (empty)
Join               Used to query across two lists that are joined through a Lookup field
Leq               Less than or equal to
Lt                  Less than
Neq             Not equal to
Now            The current date and time
Or               Boolean or operator
OrderBy     Orders the results of the query
Today         Today’s date
TodayIso    Today’s date in International Organization for Standardization (ISO) format
Where       Used to specify the Where clause of the query 




the following example will list out all the announcements which are not expired till date,we will be fetching all announcements "Title"

Code Sample:
SPQuery query = new SPQuery;
query.Viewfields = @"<fieldref name="Title"><fieldref name="Expires">";
query.Query =
@"<where>
<lt>
<fieldref name="Expires">
<value type="DateTime"><today></today></value>
</fieldref></lt>
</where>";

SPList list = SPContext.Current.Web.Lists.TryGetList("Announcements");
SPListItemCollections items = list.GetItems(query);

Here "items" are announcements title result</fieldref></fieldref>

Sunday, August 19, 2012

Using TryGetList in sharepoint 2010

TryGetList in sharepoint 2010


How to get the list directly without looping through SPWeb List collection
There is a Provision in SharePoint 2010 "TryGetList" actually will give the list by passing the list name

Here is sample to demonstrate the "TryGetList"

            SPSite site = new SPSite(SPContext.Current.Web.Url);
            SPWeb currentWeb = site.RootWeb;

            SPList customList = currentWeb.Lists.TryGetList("MyCustomList");