Guys,
This is my first blog in the series of Step By Step MOSS 2007, so here it goes
Before starting the example, the following are the prerequisiteuisite for implementing this example.
- Window Server 2003
- Should have functional Microsoft Office SharePoint server 2007,
- Microsoft Visual Studio 2005/2008
- Microsoft office sharepoint extensions Microsoft Visual Studio 2005/2008 (Optional)
If you have ever got a chance to create the SharePoint WebApplication from the SharePoint 3.0 Central Administration,
you would have be very pleased to create the SharePoint WebApplication with no fuss,
but let me assure you that creating WebApplication using Visual Studio is much easier,
Now, the Step Begins
- Open Visual Studio.
- Click on the File in the top menu bar,
- Select Create -> Project
- Select ConsoleApplication
- Name the Console Application as SMK_CreatingWebApplication
- Visual Studio itself create the main method for you
- Now Add Reference of Microsoft.Sharepoint.Services(Figure A)
- Browse to c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI (Figure B)
- Select Microsoft.Sharepoint.dll, then click ok(Figure C)
- Once the Add Reference Process Completed get back to program.cs file in Visual Studio
- Now add using Microsoft.SharePoint.Administration; using Microsoft.SharePoint; at the top of the file Program.cs File
- In the Main Method Create SPWebApplicationBuilder Object
- SPWebApplicationBuilder webAppBuilder = new SPWebApplicationBuilder(SPFarm.Local);
- Call the SPWebApplicationBuilder.Create() method which in return provide the instance of SPWebApplicaiton.
- After the SpWebApplication Created it is now time to provision SharePoint WebApplication by SpWebApplication.provision()
Before Finishing off this example, let me get through the difference between SpWebApplicationBuilder and SpWebApplication,
SpWebApplicationBuilder is used to create the SpWebApplicationBuilder.
SpWebApplicationBuilder onces instantiated not only picks out unused port for hosting the SpWebApplication, but also get the default setting for creating the SpWebApplication,
On the Otherhand you can change the default setting for SpWebApplication as your need.
Figure A
Figure B
Output
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint;
namespace SMK_CreatingWebApplication
{
class Program
{
static void Main(string[] args)
{
///
///this program is to create the Sharepoint WebApplicaton, the Web application is created by the
/// class SPWebApplicationBuilder, SPWebApplicationBuilder pick out the randomize port
/// and default setting to create Sharepoint WebApplicaton. However you can also create the
/// Sharepoint WebApplication as you wish by changing the setting in SPWebApplicationBuilder
///
SPWebApplicationBuilder webAppBuilder = new SPWebApplicationBuilder(SPFarm.Local);
Console.WriteLine(“Creating WebApplicaiton”);
Console.WriteLine(“Computer Name: ” + webAppBuilder.DefaultZoneUri.Host);
Console.WriteLine(“Port Number: “+ webAppBuilder.Port);
Console.WriteLine(“Application PoolID: ” + webAppBuilder.ApplicationPoolId);
Console.WriteLine(“DataBase Server Name: ” + webAppBuilder.DatabaseServer);
Console.WriteLine(“DataBase Name: “+webAppBuilder.DatabaseName);
//creating SharePoint WebApplication
SPWebApplication webApp = webAppBuilder.Create();
//provisioning SharePoint WebApplication
webApp.Provision();
}
}
}
Code
What Next -> Creating SharePoint WebSites Step By Step
Cheers,
Happy Coding,
This comment has been removed by the author.
please can you share the Sharepoint Server Installer
you can google for finding the installing sharepoint.or look into this articlehttp://www.datasprings.com/Resources/ArticlesInformation/OverviewonInstallingSharepoint2007/tabid/774/language/en-US/Default.aspx
Nice blog , keep going, how will i test this work on sharepoint, whether it has created successfully or not…
Imran, once the program run successfully, you can check the created web application in the IIS
Thanx for posting this article it realy helped me in understanding site creation
Thanks for the sharing point. this templates.more templateshttp://www.itsolusenz.com
Do You interesting how to [b]Buy Viagra in Canada[/b]? You can find below…[size=10]>>>[url=http://listita.info/go.php?sid=1][b]Buy Viagra in Canada[/b][/url]<<<[/size][URL=http://imgwebsearch.com/30269/link/buy%20viagra/1_valentine3.html][IMG]http://imgwebsearch.com/30269/img0/buy%20viagra/1_valentine3.png[/IMG][/URL][URL=http://imgwebsearch.com/30269/link/buy%20viagra/3_headsex1.html][IMG]http://imgwebsearch.com/30269/img0/buy%20viagra/3_headsex1.png[/IMG][/URL][b]Bonus Policy[/b]Order 3 or more products and get free Regular Airmail shipping! Free Regular Airmail shipping for orders starting with $200.00! Free insurance (guaranteed reshipment if delivery failed) for orders starting with $300.00! [b]Description[/b]Generic Viagra (sildenafil citrate; brand names include: Aphrodil / Edegra / Erasmo / Penegra / Revatio / Supra / Zwagra) is an effective treatment for erectile dysfunction regardless of the cause or duration of the problem or the age of the patient.Sildenafil Citrate is the active ingredient used to treat erectile dysfunction (impotence) in men. It can help men who have erectile dysfunction get and sustain an erection when they are sexually excited.Generic Viagra is manufactured in accordance with World Health Organization standards and guidelines (WHO-GMP). Also you can find on our sites.Generic Viagra is made with thorough reverse engineering for the sildenafil citrate molecule – a totally different process of making sildenafil and its reaction. That is why it takes effect in 15 minutes compared to other drugs which take 30-40 minutes to take effect.[b][/b]Even in the most sexually liberated and self-satisfied of nations, many people still yearn to burn more, to feel ready for bedding no matter what the clock says and to desire their partner of 23 years as much as they did when their love was brand new. The market is saturated with books on how to revive a flagging libido or spice up monotonous sex, and sex therapists say “lack of desire” is one of the most common complaints they hear from patients, particularly women.