August 3, 2011

SharePoint Definitions

Master Pages
Master pages are not a new concept or feature unique to SharePoint. Master pages were introduced with ASP.NET 2.0 as a way to centrally house and control the layout and design of a web site or application. A single master page file can control the look and feel of countless pages within a site/application. It is basically a next generation approach of how to include common content in lieu of frames or server side includes files.

----------------------------------------------

Content Pages:
Content pages are the other half of master pages. Master pages store the layout and design, while content pages define the content. The content page is bound to a master page. Together the two create the presentation layer of content for a site/application.
In SharePoint content pages are called Page Layouts. But they work similar to content pages. The master page file is combined with the page layout to create the presentation layer of content for the SharePoint site.

----------------------------------------------

Content Types:
Content Types are a new feature/concept of SharePoint 2007. They definitely warrant learning about and gaining an understanding of. A content type is a collection of settings that is applied to a particular category of content that can be reused multiple times. Through content types you can manage metadata and the behavior of a document or item type in a central, reusable way.
A content type is a reusable collection of settings you want to apply to a certain category of content. Content types enable you to manage the metadata and behaviors of a document or item type in a centralized, reusable way. Basically, content types include the columns (or fields, if you prefer) you want to apply to a certain type of content, plus other optional settings such as a document template, and custom new, edit, and display forms to use.

----------------------------------------------

ECM:
ECM is a part of MOSS 2007 and it includes things like Records Management (RM), Document Management (DM), Policy & Compliance, and Web Content Management (WCM).

----------------------------------------------

Page Layout:
A page layout can be thought of as a template for content pages. When combined with a mater page, it defines the layout and branding of a content page. Page designers and developers add field controls, Web Part Zones and Web Parts to a page essentially carving out places on a page that can contain dynamic content (entered by content owners/authors). I'll assume you know what a Web Part is... a Web Part in a Publishing site is no different from a Web Part added to any other type of SharePoint site.
When a page is created, it must be associated with exactly one page layout (which can be changed later). The page contains the actual data/content in the page. When a page is requested, SharePoint combines the master page & page layout to form the layout, then pulls the content from the page and injects it into the layout. That isn't exactly what happens; it is more of a very high level view of what's going on.

--------------------------------------------------

Site definition:
These consist primarily of multiple XML and ASPX files stored on a front-end web server in folders under the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\SiteTemplates directory.
An Onet.xml file in the installation directory, usually %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\ SiteTemplates\ site_type\ XML\, where site_type is the name of the site definition. So site_type can be "STS," "MPS," "BLOG," "SGS," or the name of a custom type of site.
Site Definitions are predefined components needs to be included when a site was created in SharePoint server.
Site definition is set of files that are stored in server. For example collaboration site definition defines the Team site, Blank site, Document Workspace, Wiki Site, Blog and Publishing defines, Publishing site and Publishing site with workflow and News site.
Site template files are stores in database. A user can create a copy of site, which can be reused and no need to create new site s, lists, document library and all.

------------------------------------------------

Ghosting:
When you create a new site, SharePoint doesn't really copy the pages for that site— default.aspx and so on—into a new database table or directory. These files exist once and only once on each of the front end Web servers. Instead, SharePoint creates a reference to those files in the database tables that define the new site, a process called "ghosting." The outcome is that the site appears to have its own unique pages, but the pages are actually shared across all sites that use the same definition.

-----------------------------------------------

Unghosting:
SharePoint can't ghost every page. Some operations, such as editing a page in FrontPage, cause SharePoint to "unghost" dependent pages for the site. Because ghosting requires all ghosted pages to be exactly the same across all the sites that share them, SharePoint unghosts, or creates a copy of the page in the database, whenever a ghosted page changes, for example, when someone performs an edit operation on the page. Unghosting lets users customize their own sites without impacting other users who might be using the same file. Unfortunately however, Unghosting also has a negative performance impact, and makes global changes, such as applying corporate branding to the entire collection of sites far more difficult. Unghosting is the primary reason why efforts to leverage the power of site definitions to change the branding of an entire site may not work as intended.

----------------------------------------------

Synchronous & Asynchronous:

1.Synchronous events are fired before the event is completed and asynchronous events are fire after the event is completed.
2.Synchronous events mostly used to stop the event completion in order to validate few things, means we can cancel the events but in case of asynchronous it is not possible.
3.Synchronous events are ends with “ing” and asynchronous events are ends with “ed”.
Ex: ItemAdding, ItemUpdating; ItemAdded, ItemUpdated.
4.Synchronous events can be used to Add/Modify the values of the list items but in case of asynchronous it is not possible as these are fired after the completion of the event.


------------------------------------------------

Classic Mode Authentication:
This is nothing but Windows Authentication. If any web application is created with Classic Mode Authentication then it cannot applicable to configure forms based authentication. But, to configure this application to use Forms Based Authentication then you can convert from Classic Mode to Claims Based. But, there is no UI exist for doing this conversion. The only way around is through PowerShell.

$app = get-spwebapplication "URL"
$app.useclaimsauthentication = "True"
$app.Update ()

But, if an application is created using Claims based and if you want to convert from Claims based to Classic Mode then it is not possible either through UI or through PowerShell. So, remember this.

-----------------------------------------------

Claims Based Authentication:
In SharePoint 2010 for a web application we can enable both windows, forms authentication. In earlier implementation to do this, we have to create two web applications which has different zones and different authentication. But, with the new claims based authentication a single application can have the capability to configure both windows and forms under single URL. All this is possible because of the authentication framework is built on Microsoft Identify Foundation. And it uses “Geneva” framework to handle this authentication.

------------------------------------------------

Differences between Visual Webparts and Asp.Net Webparts:

1. Visual Webparts - Allows you to Drag and Drop the controls from the Toolbox to WebPart Design surface. You can of course write your custom code in the code file. You can also package and deploy your webparts directly to SharePoint from VS by pressing Clt+F5. Visual studio 2010 also provides you with three different views for developing webparts. The views are split view, design view and Source view (as we have in designer 2007).
Note: The Visual Webparts project Item basically loads a User Control as a Web Part.

2. ASP.Net Webparts - Where a developer can build up User Interface and logic in a class file. You do not have designer for drag and drop of controls. This webpart inherits from standard ASP.Net webpart. For Deployment we can again use ctrl+f5 to deploy this webpart.

--------------------------------------------------------

SharePoint Sandboxed solutions:
SharePoint 2010 provides a new sandboxed environment that enables you to run user solutions without affecting the rest of the SharePoint farm. This environment means that users can upload their own custom solutions without requiring intervention from administrators, and without putting the rest of the farm at risk. This means that the existing sites\pages or components will not be affected by the newly added solution.

--------------------------------------------------------

Shared Service Provider vs. Service Application:
The key limitation of the SSP architecture was that it was configured by using a set of services, and all Web applications associated with the SSP bore the overhead of all the services even if they weren’t being used. To change the service configuration for a particular Web application, a new SSP would have to be created.
The service application architecture on the other hand, allows a set of services to be associated with a given Web application and a different set of services to be associated with another Web application. Also, the same service application can be configured differently in different Web applications; therefore, Web sites can be configured to use only the services that are needed, rather than the entire bank of services.

---------------------------------------------------------

STSADM Commands:

Deploying a WebPart: --Install -SpwebpartPack -LiteralPath "FullPathofCabFile" -Name "Named Webpart"


Activating a Feature: -- Stsadm -o activateFeature -Filename "" -Name "" -url "" -force


De-Activating a Feature: -- Stsadm -o deactivateFeature -Filename "" -Name "" -url "" -force


Installing a Feature: -- Stsadm -o installFeature -filename "" -name "" -force


UnInstalling a Feature: -- Stsadm -o uninstallFeature -filename "" -name "" -force

Steps for Migrating MOSS 2007 Application to Sharepoint 2010

-Take the backup of the content databases from sql server.

-Create an empty database with same names.

-Restore the content databases to the newly created databases.

-Then go to the central administration in the server.

-Create an empty web application

-Click on the application management tab

-Click on “content databases” link

-Delete the already existing database that was created when the web application was created.

-Now use stsadm to add restored DB’s to this web app

-Run this command for each content database.

Stsadm –o addcontentDB –URL ‘url of the application’ -databasename ‘database
name’-databaserver ‘server name’


Or else run this command power shell management console

New-SPContentDatabase -Name -WebApplication

-Run IISRESET
from command prompt.

-Copy the production server 12-hive folder and copy the 80 folder present
in “\\C:\Inetpub\wwwoot\wss\virtualDirectories\80” to 14-hive folder.

-Copy the dll’s from the \\assembly\Gac_msil\ folder from the production server to the working environment.

-Change the connection strings present in all the files present in the \\12\template\CONTROL TEMPLATES\ folder and \\12\template\LAYOUTS\ folder.

-Copy the backup of the custom databases of applications if any to the Database working environment.

-Create empty databases in Sql server with the same names.

-Restore the respective databases by right-clicking on the Databases-Tasks-Restore-Database.

-Select “Source of restore” option as “From device” and browse to the database backup files.

-Then check the application

-Create the Virtual Directories if the applications have any.

April 14, 2011

Page Title disappears after async postback in SharePoint

Add the following script in the content editor web part or in the custom web part
-------------

January 20, 2011

Jquery for Hiding/Showing Div tags


var prevTag = null;
var prevAid = null;

function ShowAnswer(id, aID) {
if (document.getElementById(aID).innerHTML == 'View" ) {
document.getElementById(aID).innerHTML = 'Hide" ;
}
else if (document.getElementById(aID).innerHTML == 'Hide') {
document.getElementById(aID).innerHTML = 'View';
}
$("#" + id).show("slow"); //Shows the Tag
if (prevTag == id && prevTag != null) {
$("#" + prevTag).hide("slow"); //Hides the Tag when we click on same div tag for more than 1 time.
prevTag = null;
prevAid = null;
}
else if (prevTag != null) {
if (document.getElementById(prevAid).innerHTML == 'View') {
document.getElementById(prevAid).innerHTML = 'Hide";
}
else if (document.getElementById(prevAid).innerHTML == 'Hide') {
document.getElementById(prevAid).innerHTML = 'View';
}
$("#" + prevTag).hide("slow");
prevTag = id;
prevAid = aID;
}
else {
prevTag = id;
prevAid = aID;
}
}

Code snippet for checking availability of a website/ webservice


private bool WebSiteIsAvailable(string Url)
{
string Message = string.Empty;
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(Url);
request.Method = "GET";
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
// Do nothing; we're only testing to see if we can get the response
}
}
catch (WebException ex)
{
Message += ((Message.Length > 0) ? "\n" : "") + ex.Message;
}
return (Message.Length == 0);
}

Code snippet for Checking Internet Connection in C#

private Boolean fnChkInternetConn()
{
Boolean bol = false;
System.Net.HttpWebRequest objreq = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create("http://www.google.com");
try
{
System.Net.HttpWebResponse objres = (System.Net.HttpWebResponse)objreq.GetResponse();
objreq.Abort();
if (objres.StatusCode == System.Net.HttpStatusCode.OK)
{
bol = true;
}
}
catch (System.Net.WebException weberrt)
{
bol = false;
}
catch (Exception except)
{
bol = false;
}
return bol;
}

Migrate SharePoint 2010 Infopath to SharePoint Online

 Below are the steps to follow to migrate the Infopath data to SP Online.