Installing SharePoint Foundation 2010 – Step by Step

We are always fall in problem to install SharePoint 2010 for the first time. Here is the step by step approach to install SharePoint 2010. This article is very much handy to install SharePoint Foundation 2010. Installation of other version of SharePoint is almost same. Here I have installed Windows 2008 Server in VMWare Workstation with 4GB of RAM. Below is the step by step approach to install SharePoint 2010.

Step 1: Install Windows 2008 Server R2

Step 2: Configure Windows Server 2008 R2 to install SharePoint 2010

Step 3: Create Domain Controller

Step 4: Install SQL Server – 2008 R2

Step 5: Install Prerequisites

There are two ways to install prerequisite –

i)        First way – Download the following prerequisites according to your Server Requirements and install it’s to the server. Keep in mind, some are already installed in your computer so don’t worry about installation problem. May be all prerequisite is not necessary for your server.
a.  Windows 2008 R2 and Windows Server 2008 KB971831
b. WCF Fix article for Windows 2008 R2 and Windows 7 KB976462
c. Microsoft SQL Server 2008 Native Client
d. Microsoft “Geneva” Framework Runtime
e. Microsoft Sync Framework Runtime v1.0 (x64)
f. Microsoft Chart Controls for Microsoft .NET Framework 3.5
g. Microsoft SQL Server 2008 Analysis Services ADOMD.NET
h. PowerShell V2 RTM
i. SQL Server 2008 SP1
j. .NET Framework 3.5 Service Pack 1 (Full Package)
k. Microsoft Filter Pack x64 for sharepoint

ii)       Second way – This is the very easy way. Just click executable file (SharePointFoundation.exe). Click “Install software prerequisite” of the screen.

1

Click “Next” to start installation of pre requisites

1-1

Mark for license Agreement and Click Next

1-2Pre requisites is installing.

1-3

Click Finish to complete installation of Pre requisites.

1-4

Step 6: Start SharePoint 2010 Foundation installation – Click Executable file (SharePointFoundation.exe). Click “Install SharePoint Foundation” in the splash screen.

2

Step 7: Mark to the license agreement and click Continue.

3

Step – 8: Browse data location and Click “Install Now”

4Installation Progress…

5

Step 9: Mark “Run the SharePoint Product Configuration Wizard now” and click “Close”.

6

Step 10: Click “Next” of the SharePoint Products Configuration Wizard.

7

Step 11: Click “Yes” of the following pop up screen and then click “Next”.

8

Step 12: Select “Create a new server farm” and then click “Next” of the following screen.

9

Step -13: Type your database server name, database Name (default: SharePoint_Config), user name (domain name\User name) and password in the following Database Settings screen.

10

Step 14: Type Passphrase and confirm passphrase in the Farm Security Settings screen and click “Next”

11

Step 15: To specify port of Central administration we application – Mark specify port number and type your desired port. Select NTLM as default as authentication provider for Web application.

12

Step 16: Click “Next” in following SharePoint Product Configuration Wizard. If required click Advanced Settings for advanced configuration

13

Configuring SharePoint Products…..

14Step 17: You will see the following screen after configuring SharePoint Server successfully. Necessary information is given here. Click “Finish” to continue.

15

Step 18: Type username (my user name: Administrator) and password to enter the server.

16

Step 19: Select “No, I don’t wish to participate” and click “ok” in the following screen.

17

Step – 20: Click “Start the Wizard” in the following screen.

18

Step -21: Select “Use existing managed account” and click “Next”

19Processing…

20Step -22: Type site title and description, select template as Team site and click Ok.

21

Step – 23: Farm configuration completed. Click “Finish” in the Farm Configuration wizard.

22

Step – 24: Now you will see the central administration. If you see in the closer look, you will see it uses port -2010(read circle) which you configured at step – 15.

23

Step – 25: If you want to see the site which you already created just type “htttp://yourservername:80” in the url.

24Yes! You have successfully installed and configured SharePoint 2010. Thanks for your patience.

Populate Dropdownlist with selected Index

This is a demo to populate asp.net dropdownlist by C#.

Step 1: Create a asp.net dropdownlist

Create a dropdownlist in asp.net page. Here, I created a dropdownlist name ddlStudentInfo.




Step 2: Create StudentInfo class

Create a student info class to create list of StudentInfo object.

public class StudentInfo
{
public int Id { get; set; }
public string Name { get; set; }
}

Step 3: Populate dropdownlist

Create a list of StudentInfo object. Make it data source of dropdownlist and choose your selected index. Here, I choose selected index 2 means dropdownlist shows Asrafuzzaman as selected text and 3 as selected value. I have write all those in Page Load. You can do as you required.

protected void Page_Load(object sender, EventArgs e)
{
List lstStudentInfo = new List();

StudentInfo objStudentInfo1 = new StudentInfo();
objStudentInfo1.Id = 1;
objStudentInfo1.Name = "Mahedee Hasan";

lstStudentInfo.Add(objStudentInfo1);

StudentInfo objStudentInfo2 = new StudentInfo();
objStudentInfo2.Id = 2;
objStudentInfo2.Name = "Mahmud Ahsan";
lstStudentInfo.Add(objStudentInfo2);

StudentInfo objStudentInfo3 = new StudentInfo();
objStudentInfo3.Id = 3;
objStudentInfo3.Name = "Asrafuzzaman";
lstStudentInfo.Add(objStudentInfo3);

StudentInfo objStudentInfo4 = new StudentInfo();
objStudentInfo4.Id = 4;
objStudentInfo4.Name = "Enamul Haque";
lstStudentInfo.Add(objStudentInfo4);

ddlStudentInfo.DataSource = lstStudentInfo;
ddlStudentInfo.DataValueField = "Id";
ddlStudentInfo.DataTextField = "Name";
ddlStudentInfo.SelectedIndex = 2; //Selected index 2 means selected value is 3 and text is Asrafuzzaman
ddlStudentInfo.DataBind();

}

ddlStudentInfo

File Upload to Server with ASP.net

File Upload to Server with ASP.net Uploading file to server from client sometimes very tricky. Sometimes it is required that you will not upload file more than certain size. This is the step by step approach to upload file from client to server.

Step 1: Add html input type as file

<input id =”uploadFile” type=”file” runat=”server” />

Step 2: Create a button to upload file in the server

<asp:Button ID=”Button1″ runat=”server” OnClick=”Button1_Click”  />

Step 3: Create a folder in the web project like “TempFiles”
Step 4: Upload file in the server.

protected void Button1_Click(object sender, EventArgs e)
{

if (this.uploadFile.PostedFile != null)
{
// Get a reference to PostedFile object
HttpPostedFile huploadFile = uploadFile.PostedFile;

// Get size of uploaded file
int nFileLen = huploadFile.ContentLength;

decimal fileSize = uploadFile.PostedFile.ContentLength / 1024;
if (fileSize > 100) //If file size is no more than 100 KB
{
this.lblMsg.Text = "Size of this image is greater than 100KB";
return;
}

byte[] scriptData = new byte[nFileLen];

// Read uploaded file from the Stream
huploadFile.InputStream.Read(scriptData, 0, nFileLen);

string filePath = Server.MapPath("TempFiles");

filePath = filePath + "\\" + Path.GetFileName(uploadFile.PostedFile.FileName); //concate filename with file path
FileStream newFile = new FileStream(filePath, FileMode.Create);

// Write data to the file
newFile.Write(scriptData, 0, scriptData.Length);

// Close file
newFile.Close();
}
else
{
lblMsg.Text = "This is an empty file";

}
}

How to copy folder with content with C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CopyFolder
{
class Program
{
static void Main(string[] args)
{
string sourcePath = @"G:\Mahedee_Share\Created";
string destPath = @"G:\Mahedee_Share\Development";
CopyFolder(sourcePath,destPath);
}

private static void CopyFolder(string sourcePath, string destinationPath)
{

try
{

//Now Create all of the directories
foreach (string dirPath in Directory.GetDirectories(sourcePath, "*",
SearchOption.AllDirectories))
Directory.CreateDirectory(dirPath.Replace(sourcePath, destinationPath));

//Copy all the files & Replaces any files with the same name
foreach (string newPath in Directory.GetFiles(sourcePath, "*.*",
SearchOption.AllDirectories))
System.IO.File.Copy(newPath, newPath.Replace(sourcePath, destinationPath), true);
}
catch (Exception exp)
{

}
}
}
}

How to configure IIS for different port

1.      Open IIS Manager (run -> inetmgr)
2.      In the Connections pane, expand the Sites node in the tree, and then click to select the site for which you want to add/edit binding.
3.      Right click on the site and click Edit bindings
4.      Select Port on the site binding pane
5.      Click Edit button
6.      In Edit Site Binding pane type port (ex. 1080) and click Ok
IIS Port change

How to Create Domain Controller in Windows Server 2008 R2

Domain concept is introduced in windows NT. Domain Controller (DC) is a server that is responsible to maintain security within window server domain. To install Domain Controller (DC) in Windows Server 2008 R2, follow the steps.

Step 1: Click “Start -> Administrative tools -> Server Manager -> Roles -> Add Roles”

1

Step 2: Click next on the following screen.

2

Step 3: Select Server Role – “Active directory domain service” and Click Next.

3

4Step 4: Click “Install”

5

Step 5: Now install DNS Server and active directory service. Go to “run” and type “dcpromo”

6

Step 6: In Active Directory Domain Services Installation Wizard. Press “Next” and don’t check on “Use advance mode installation”.

7

8

Step 7: Select “Create a new domain in a new forest” and click “Next” on the following screen

9

Step 8: Type your domain name and click “Next”.

10

Step 9: Select Windows Server 2008 R2 and click “Next”

11

Step 10: If this is the first Domain controller then the following message will be visible. Check “DNS Server” and click “Next”

12Step 11: Press “Yes” to continue.

13

Step 12: Select the location to keep log of Active Directory Domain Controller.

14

Step 13: Type administrator password and Confirm password for directory service and click “Next”

15

Step 14: Click “Next” of Summary window and check reboot the computer of the following screen.

16

17

Step 15: Your Domain Controller installed successfully. Now login to the system by domain Id.

last

Install SQL Server 2008 R2 – Step by Step

We often fall problem to install SQL Server 2008 R2. Here is the step by step procedure to install SQL Server 2008 R2. Microsoft .NET Framework 3.5 SP1 is the pre-requisite for SQL Server 2008 R2. If it is not installed in your computer, install it before proceed to the setup procedure.

Step 1: Run DVD of SQL Server 2008 R2 or Open DVD and click setup.exe

1

Step 2: Select Installation and Click New installation or add features to an existing installation.

2

Step 3: After completing pre installation check, press Ok.

3

Step 4: Type Product Key and click “Next”.

4

Step 5: Select License Term and click “Next”.

5

Step 6: Click “Install” in the following screen.

6

Step 7: Setup performed Support Rules Validation. If no error found, click “Next”. Turn off your windows firewall from control panel to eliminate warning of windows firewall of following screen.

7

Step 8: Select Setup Role – SQL Server Feature Installation. Click Next.

8

Step 9: Select Features or Click “Select All” and click “Next”.

9

Step 10: Click “Next” of Installation Rule windows.
10Step 11: Select Default Instance for simplicity and click “Next”.11

Step 12: Click “Next” after confirming disk space requirement

12

Step 13: In the Server Configuration Screen click “Use the same account for all SQL Server Services”

13

Step 14: In the Pop up screen type user name with domain name and password. Then click Ok.

14

Step 15: Click “Next” in the Server Configuration Screen.

15

Step 16: Select Mixed Mode, type password and confirm password. Click “Add Current user” and click Next in Database Engine Configuration Screen.

16

Step 17: Click “Add Current User” & “Next” in Analysis Service Configuration Screen.

17

Step 18: Select Native Mode & Click Next in Reporting service configuration screen.

18

Step 19: Click “Next” in error reporting screen.

Step 20: Click “Next” in the following screen.

20Step 21: Click “Install” in the following screen.

21Installation progressing……22

Step 22: Complete Installation. Click Close button.

23

Difference between String and StringBuilder

String and StringBuilder class both are used to handle string.
StringBuilder is an immutable class means that you can insert, append and replace without creating a new StringBuilder instance each time.
String is immutable, each time you perform an operation on the string – you are actually creating a new instance of string to replace the old one.
So according to the discussion, the StringBuilder is more efficient for operations to manipulate strings.
The most common operation with a string is concatenation. When you use the “String” object to concatenate two strings, the first string is combined to the other string by creating a new instance in the memory and then the old string is deleted.
When you make a “StringBuilder” object for concatenation the Append method is used which is perform insertion operation on the existing string. So, StringBuilder is more efficient in case of large amounts of string manipulation.

Have a look on the following code snippet.


string str = string.Empty;
for (int i = 0; i < 1000; i++) { str += i.ToString() + ” “; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < 1000; i++) { sb.Append(i); sb.Append(‘ ‘); } [/csharp] Now think, which one is faster? Right! The second one. Because, for the first snippet, every time new instance of string is created and the for the second one, StringBuilder instance is created only at once.

Display information by ASP.net Literal Control

The literal control is similar to the Label control. Unlike the Label control, the Literal control does not render its content inside of a tag. You can use the Literal control to display text or HTML content in a browser.

Literal control does not support either CssClass or BackColor properties.

Literal control has mode property which Label has not.
Three mode property of Literal control:

  1. PassThrough: Displays the contents of the control without encoding.
  2. Encode: The contents of the control are converted to an HTML-encoded string.
  3. Transform: Unsupported markup-language elements are removed from the contents of the control. If the Literal control is rendered on a browser that supports HTML or XHTML, the control’s contents are not modified.

You will be clear after watching output of the following

Write the following code in your aspx page. Here I used 4 literal. 1st one for displaying simple message from code behind. Others 3 are displayed the content in different mode of literal.

asp:Literal>

asp:Literal>
asp:Literal>
asp:Literal>
protected void Page_Load(object sender, EventArgs e)
{
    this.ltrlMsg.Text = "Welcome to ASP.net Literal Control!";
}

The output of the code is look like this.
Welcome to ASP.net Literal Control!
This is Mahedee Hasan
This is Mahedee Hasanll
This is Mahedee Hasan