Dec 30, 2008


What Is SharePoint?
SharePoint Facts
Why Should You Use SharePoint?
Microsoft Office SharePoint Server 2007
Windows SharePoint Services 3.0
Which SharePoint Technology Is Right For You?
MOSS 2007
Top 10 Benefits of Windows SharePoint Services

What is SharePoint?
SharePoint is an enterprise information portal, from Microsoft, that can be configured to run Intranet, Extranet and Internet sites. Microsoft Office SharePoint Server 2007 allows people, teams and expertise to connect and collaborate. A SharePoint enterprise portal is composed of both SharePoint Portal and Windows SharePoint Services, with SharePoint being built upon WSS. WSS is typically used by small teams, projects and companies. SharePoint Server is designed for individuals, teams and projects within a medium to large company wide enterprise portal.

Some SharePoint facts
• SharePoint is the fastest-growing product in the history of Microsoft
• Over 75 million licenses of SharePoint have been sold worldwide
• SharePoint is listed, by Forrester, as the number 1 portal product
• SharePoint is positioned as a leader within the Gartner Magic Quadrant for Horizontal Portals products
• Over 400 case studies have been published on SharePoint

Why should you use SharePoint?
SharePoint solves four main problems:

• As companies grow so does the amount of their files. It soon becomes difficult to keep track of the multiplying documents and their locations. SharePoint overcomes this by allowing you to store and locate your files in a central site. Files can also be located through company wide searches of your SharePoint enterprise portal.

• Sharing work files through email is a cumbersome process. SharePoint eliminates this by allowing files to be stored in one location, allowing easy access to all team members.

• Today’s work occurs over multiple locations, whether it is in different countries, office locations, separate departments or at your home office. SharePoint enables teams and individuals to connect and collaborate together regardless of where they are located.

• It’s difficult and time consuming to create and maintain sites. SharePoint allows anyone to create sites for use within their company’s Intranet, as they are needed, whether they are departmental sites, document libraries, meetings sites, survey sites, or discussion boards.

Microsoft Office SharePoint Server 2007:

Microsoft Office SharePoint Server 2007 is a collaborative enterprise portal that is built upon WSS 3.0. MOSS 2007 allows people, teams and expertise to connect and collaborate. Unlike WSS, SharePoint Server is not free and requires an additional license. MOSS 2007 comes in two versions – Standard and Enterprise.
The main components of SharePoint 2007 are

enterprise search,
enterprise content management,
business process and forms,
and business intelligence.

Previous versions of SharePoint Server included SharePoint Portal Server 2003 and before that SharePoint Portal Server 2001. To preview SharePoint’s new features visit the Microsoft Office SharePoint Server 2007 demo.

Windows SharePoint Services 3.0 :

Windows SharePoint Services 3.0 is the platform on which all SharePoint Products and Technologies are built. WSS 3.0 is for is suitable for small teams, projects and organizations.
WSS’s project collaboration, document workspace, meeting sub-site, and discussion board features allow individuals and small teams to collaborate and share information online. Past versions of Windows SharePoint Services included Windows SharePoint Services 2.0 and SharePoint Team Services. New features in WSS 3.0 include integrated workflows, RSS feeds, blogs, wikis and ASP-style Web parts. To preview more of WSS 3.0’s new features visit the Microsoft
Windows SharePoint Services 3.0 demo.
Not sure which SharePoint technology is right for you?
Visit Microsoft online to find out which SharePoint technology meets your company’s requirements.

Microsoft Office SharePoint Server 2007 Top 10 Benefits:

1. Provide a simple, familiar, and consistent user experience.

Office SharePoint Server 2007 is tightly integrated with familiar client desktop applications, e-mail, and Web browsers to provide a consistent user experience that simplifies how people interact with content, processes, and business data. This tight integration, coupled with robust out-of-the-box functionality, helps you employ services themselves and facilitates product adoption.

2. Boost employee productivity by simplifying everyday business activities.

Take advantage of out-of-the-box workflows for initiating, tracking, and reporting common business activities such as document review and approval, issue tracking, and signature collection. You can complete these activities without any coding. Tight integration with familiar client applications, e-mail, and Web browsers provide you with a simple, consistent experience. Modifying and extending these out-of-the-box workflow processes is made easy through tools like Microsoft Office SharePoint Designer 2007 (the next release of Microsoft Office FrontPage).

3. Help meet regulatory requirements through comprehensive control over content.

By specifying security settings, storage policies, auditing policies, and expiration actions for business records in accordance with compliance regulations, you can help ensure your sensitive business information can be controlled and managed effectively. And you can reduce litigation risk for your organization. Tight integration of Office SharePoint Server 2007 with familiar desktop applications means that policy settings are rendered onto client applications in the Microsoft Office system, making it simpler for employees to be aware of and comply with regulatory requirements.

4. Effectively manage and repurpose content to gain increased business value.

Business users and content authors can create and submit content for approval and scheduled deployment to intranet or Internet sites. Managing multilingual content is simplified through new document library templates that are specifically designed to maintain a relationship between the original version and different translations of a document.

5. Simplify organization-wide access to both structured and unstructured information across disparate systems.

Give your users access to business data found in common line-of-business systems like SAP and Siebel through Office SharePoint Server 2007. Users can also create personalized views and interactions with business systems through a browser by dragging configurable back-end connections. Enterprise-wide Managed Document Repositories help your organizations store and organize business documents in one central location.

6. Connect people with information and expertise.

Enterprise Search in Office SharePoint Server 2007 incorporates business data along with information about documents, people, and Web pages to produce comprehensive, relevant results. Features like duplicate collapsing, spelling correction, and alerts improve the relevance of the results, so you can easily find what you need.

7. Accelerate shared business processes across organizational boundaries.

Without coding any custom applications, you can use smart, electronic forms–driven solutions to collect critical business information from customers, partners, and suppliers through a Web browser. Built-in data validation rules help you gather accurate and consistent data that can be directly integrated into back-end systems to avoid redundancy and errors that result from manual data re-entry.

8. Share business data without divulging sensitive information.

Give your employees access to real-time, interactive Microsoft Office Excel spreadsheets from a Web browser through Excel Services running on Office SharePoint Server 2007. Use these spreadsheets to maintain and efficiently share one central and up-to-date version while helping to protect any proprietary information embedded in the documents (such as financial models).

9. Enable people to make better-informed decisions by presenting business-critical information in one central location.

Office SharePoint Server 2007 makes it easy to create live, interactive business intelligence (BI) portals that assemble and display business-critical information from disparate sources, using integrated BI capabilities such as dashboards, Web Parts, scorecards, key performance indicators (KPIs), and business data connectivity technologies. Centralized Report Center sites give users a single place for locating the latest reports, spreadsheets, or KPIs.

10. Provide a single, integrated platform to manage intranet, extranet, and Internet applications across the enterprise.

Office SharePoint Server 2007 is built on an open, scalable architecture, with support for Web services and interoperability standards including XML and Simple Object Access Protocol (SOAP). The server has rich, open application programming interfaces (APIs) and event handlers for lists and documents. These features provide integration with existing systems and the flexibility to incorporate new non-Microsoft IT investments.

Top 10 Benefits of Windows SharePoint Services:

1. Improve team productivity with easy-to-use collaborative tools
Connect people with the information and resources they need. Users can create team workspaces, coordinate calendars, organize documents, and receive important notifications and updates through communication features including announcements and alerts, as well as the new templates for creating blogs and wikis. While mobile, users can take advantage of convenient offline synchronization capabilities.

2. Easily manage documents and help ensure integrity of content
With enhanced document management capabilities including the option to activate required document checkout before editing, the ability to view revisions to documents and restore to previous versions, and the control to set document- and item-level security, Windows SharePoint Services can help ensure the integrity of documents stored on team sites.

3. Get users up to speed quickly
User interface improvements in Windows SharePoint Services 3.0 include enhanced views and menus that simplify navigation within and among SharePoint sites. Integration with familiar productivity tools, including programs in the Microsoft Office system, makes it easy for users to get up to speed quickly. For example, users can create workspaces, post and edit documents, and view and update calendars on SharePoint sites, all while working within Microsoft Office system files and programs.

4. Deploy solutions tailored to your business processes
While standard workspaces in Windows SharePoint Services are easy to implement, organizations seeking a more customized deployment can get started quickly with application templates for addressing specific business processes or sets of tasks.

5. Build a collaboration environment quickly and easily
Easy to manage and easy to scale, Windows SharePoint Services enables IT departments to deploy a collaborative environment with minimal administrative time and effort, from simple, single-server configurations to more robust enterprise configurations. Because deployment settings can be flexibly changed, less pre-planning time is required and companies can get started even faster.

6. Reduce the complexity of securing business information
Windows SharePoint Services provides IT with advanced administrative controls for increasing the security of information resources, while decreasing cost and complexity associated with site provisioning, site management, and support. Take advantage of better controls for site life-cycle management, site memberships and permissions, and storage limits.

7. Provide sophisticated controls for securing company resources
IT departments can now set permissions as deep down as the document or item level, and site managers, teams, and other work groups can initiate self-service collaborative workspaces and tasks within these preset parameters. New features enable IT to set top-down policies for better content recovery and users, groups, and team workspace site administration.

8. Take file sharing to a new level with robust storage capabilities
Windows SharePoint Services supplies workspaces with document storage and retrieval features, including check-in/check-out functionality, version history, custom metadata, and customizable views. New features in Windows SharePoint Services include enhanced recycle bin functionality for easier recovery of content and improved backup and restoration.

9. Easily scale your collaboration solution to meet business needs
Quickly and easily manage and configure Windows SharePoint Services using a Web browser or command-line utilities. Manage server farms, servers, and sites using the Microsoft .NET Framework, which enables a variety of custom and third-party administration solution offerings.

10. Provide a cost-effective foundation for building Web-based applications
Windows SharePoint Services exposes a common framework for document management and collaboration from which flexible and scalable Web applications and Internet sites, specific to the needs of the organization, can be built. Integration with Microsoft Office SharePoint Server 2007 expands these capabilities further to offer enterprise-wide functionality for records management, search, workflows, portals, personalized sites, and more.

Ref :

How to use CASE statements in SQL Query : + SQL SERVER 2005

First lets create a sample table named testable

CREATE TABLE [dbo]. [testable]

[MaterialID] [int] NOT NULL,
[type] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Description] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[value] [decimal](18, 0) NULL


Now lets insert some values like

INSERT INTO testtable
SELECT 1,'cem','RAO',2
SELECT 5,'wtr','Water',4
SELECT 6,'cem','rao',5

Now write a query to that selects the column MaterialID, and two assigned columns named CementDescription and TestDescription where the CementDescription column should be filled with ‘CEMEMT’ for each row in the table where the type is ‘cem’ and the WaterDescription column should be filled with ‘Water’ for each row of the table where the type is ‘wtr’.

SELECT MaterialID,
CASE WHEN type = 'cem' THEN 'CEMENT' ELSE NULL END as CementDescription ,
CASE WHEN type = 'wtr' THEN 'WATER' ELSE NULL END as WaterDescription
FROM testtable


MaterialID CementDescription WaterDescription


Not only this eg. there are lot to do with CASE in SQL.

Dec 23, 2008

Threads Implementation in C# + source code

Thread in C# :
Introduction to Threads In C# :
Threads: Threads are often called lightweight processes. However they are not

A Thread is a small set of executable instructions, which can be used to isolate a task from a process.
Multiple threads are efficient way to obtain parallelism of hardware and give interactive user interaction to your applications.

C# Thread:.
. Net Framework has thread-associated classes in System.Threading namespace. The following steps demonstrate how to create a thread in C#.

Step 1. Create a System.Threading.Thread object.
Creating an object to System.Threading.Thread creates a managed thread in .Net environment. The Thread class has only one constructor, which takes a ThreadStart delegate as parameter. The ThreadStart delegate is wrap around the callback method, which will be called when we start the thread.

Step 2: Create the call back function
This method will be a starting point for our new thread. It may be an instance function of a class or a static function. Incase of instance function, we should create an object of the class, before we create the ThreadStart delegate. For static functions we can directly use the function name to instantiate the delegate. The callback function should have void as both return type and parameter. Because the ThreadStart delegate function is declared like this. (For more information on delegate see MSDN for “Delegates”).

Step 3: Starting the Thread.
We can start the newly created thread using the Thread’s Start method. This is an asynchronous method, which requests the operating system to start the current thread.
For Example:
// This is the Call back function for thread.

Public static void MyCallbackFunction()
while (true)
System.Console.WriteLine(“ Hey!, My Thread Function Running”); ………

public static void Main(String []args)
// Create an object for Thread
Thread MyThread = new Thread(new ThreadStart (MyCallbackFunction));
MyThread.Start() ……

Killing a Thread:
We can kill a thread by calling the Abort method of the thread. Calling the Abort method causes the current thread to exit by throwing the ThreadAbortException.


Suspend and Resuming Thread:

We can suspend the execution of a thread and once again start its execution from another thread using the Thread object’s Suspend and Resume methods.

// causes suspend the Thread Execution.
MyThread.Resume() ;
// causes the suspended Thread to resume its execution.

Thread State:
A Thread can be in one the following state.
Unstarted - Thread is Created within the common language run time but not Started still.
Running - After a Thread calls Start method
WaitSleepJoin - After a Thread calls its wait or Sleep or Join method.
Suspended - Thread Responds to a Suspend method call.
Stopped - The Thread is Stopped, either normally or Aborted.

We can check the current state of a thread using the Thread’s ThreadState property.

Thread Priorty:
The Thread class’s ThreadPriority property is used to set the priority of the Thread.

A Thread may have one of the following values as its Priority:






The default property of a thread is Normal.

REF: Code project

How to select an item in a DropDownList by Value

1. //How to select an item in a DropDownList by Value

ListItem li = yourDropDownlist.Items.FindByValue(”yourValue”);

if (li != null)

yourDropDownlist.SelectedIndex = yourDropDownlist.Items.IndexOf(li);

2. //How to check if value exists in DropDownList

public static bool IsValueInDropdownList(DropDownList controlName,string strValue)


if (controlName.Items.FindByValue(strValue) != null)

return true;

return false;


How to Remove item from DropDownList by Value

// 1st method, to Remove item from DropDownList by Value
ListItem li = dropdownlist.Items.FindByValue(strValue);
if(li != null)
// 2nd method, combined form

Dec 22, 2008

CLR Stored Procedure to decrypt the encrypted value

Here is a CLR Stored Proc to decrypt the encrypted value and return it through output variable.

After launching Visual Studio 2005 choose File -> New Project.
In the dialog box under Project Type choose Visual C# -> Database and then choose SQL Server Project on the right side.
I named my project CLR_Decrypt . This creates a solution and a project both named CLR_Decrypt . Visual Studio will also ask you to create a database reference or use an existing one.

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.IO;
using System.Text;
using System.Security.Cryptography;
using Microsoft.SqlServer.Server;

public partial class StoredProcedures
public static void CLR_Decrypt(SqlString employeeID, out SqlBinary decryptedSignatureBytes)
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Context Connection=true";
string signatureString = string.Empty;
string signatureString1 = string.Empty;
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = @"SELECT EncryptedSignatureImage
EncryptedEmployeeID = '" + employeeID.ToString() + "'";

SqlDataReader rdr = cmd.ExecuteReader();
// This to call the Decrypt method to Decrypt the already encrypted text.
using (rdr)
while( rdr.Read() )
signatureString = rdr.GetString(0).ToString();
signatureString1 = DecryptText(signatureString);

// To convert string to SQL binary
decryptedSignatureBytes = Convert.FromBase64String(signatureString1);

Dec 18, 2008

how to Export Grid view To Excel + Asp.Net 2.0 + C#

The below code Exports the Grid view to Excel in C#.

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;

/// Exports Grid To Excel

private void ExportToExcel(GridView gv)
StringWriter stw = null;
HtmlTextWriter htextw = null;
string fileName = string.Empty;

fileName = "Test";
HtmlForm form = new HtmlForm();
string attachment = "attachment; filename=" + fileName + ".xls";
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
Response.Buffer = true;
stw = new StringWriter();
htextw = new HtmlTextWriter(stw);
gv.Columns[10].Visible = true;
stw = null;
htextw = null;

This code will open a open or Save dialog to open or save the .xls files created.

How to write a Property for ListBox to Generate ID List for Selected Items + C#

This is Property for ListBox to Generate ID List for Multiple Selected Items.
Use this namespace because here we use regex in the property.
using System.Text.RegularExpressions;

/// Gets Or Sets the IDsList.

private string IDsList
string IDs = string.Empty;
foreach (ListItem item in lbSample.Items)
if (item.Selected)
IDs = IDs + item.Value + ",";
IDs = System.Text.RegularExpressions.Regex.Replace(IDs, ",$", "");
return IDs;
foreach (int item in value)
if (lbSample.Items.FindByValue(item.ToString()) != null)
lbSample.Items.FindByValue(item.ToString()).Selected = true;

This will automatically return the list of IDs selected in the List box.