Thursday, April 30, 2009

Creating SharePoint Web Application Step By Step


Guys,


This is my first blog in the series of
Step By Step MOSS 2007, so here it goes



Creating SharePoint Web Application Step By Step

Before starting the example, the following are the prerequisiteuisite for implementing this example.


  1. Window Server 2003
  2. Should have functional Microsoft Office SharePoint server 2007,
  3. Microsoft Visual Studio 2005/2008
  4. 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 SharePoin
t WebApplication with no fuss,


but let me assure you that creating WebApplication using Visual Studio is much easier,


Now, the Step Begins

  1. Open Visual Studio.
  2. Click on the File in the top menu bar,
  3. Select Create -> Project
  4. Select ConsoleApplication
  5. Name the Console Application as SMK_CreatingWebApplication
  6. Visual Studio itself create the main method for you
  7. Now Add Reference of Microsoft.Sharepoint.Services(Figure A)
  8. Browse to c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI (Figure B)
  9. Select Microsoft.Sharepoint.dll, then click ok(Figure C)
  10. Once the Add Reference Process Completed get back to program.cs file in Visual Studio
  11. Now add using Microsoft.SharePoint.Administration; using Microsoft.SharePoint; at the top of the file Program.cs File
  12. In the Main Method Create SPWebApplicationBuilder Object
  13. SPWebApplicationBuilder webAppBuilder = new SPWebApplicationBuilder(SPFarm.Local);
  14. Call the SPWebApplicationBuilder.Create() method which in return provide the instance of SPWebApplicaiton.
  15. 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




Figure C











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,


Monday, April 27, 2009

Step by Step MOSS 2007 by Shakir Majeed Khan

I am starting a new series of MOSS 2007 tutorials, a step by step examples of MOSS object model,
in which i demonstrate the different feature of MOSS 2007 by developing them through Microsoft Visual Studio.

Monday, April 13, 2009

70-542 Cleared

By The Grace of God, today i cleared my Certification of Microsoft Windows SharePoint Server 2007 (Application Development) .

Following suggestion i wants to make for the guys who will be aiming for Microsoft Windows sharepoint sever 2007 application development.

  1. I thorughly covered two books. 1. Microsoft sharepoint 2007 developement Unleashed and 2. Professional Developement Microsoft SharePoint 2007 (Programmer to Programmer)
  2. I always preferred to read from hard cover book, reading from the book is quite relaxing and you can thoroughly understand the context.
  3. I used to write the sample code by my self so that i can have the grip on the topic.
  4. I have passed my Microsoft windows sharepoint services 3.0 application development 70-541 on 3rd march, and keep a gap of 40 days to attempt for Microsoft Windows SharePoint Server 2007 (Application Development)
Now i am aiming for working on the integrated application,

Thursday, April 09, 2009

Go Chelsea Go

Chelsea will now win the CL this year surely

Tuesday, March 10, 2009

Monday, March 09, 2009

Moss doesnt restrict the styling and look and feel of the site

Check out the following site which are been build on MOSS,

The main thing which i try to figure out is that how people structure the application in MOSS, site, sub sites, pages,

you can trace the structure by hover over the main navigation.


http://www.paulmitchellpro.com/

http://www.carlsberggroup.com/Pages/Default.aspx


Bilingual application


http://www.trainershouse.fi/en/frontpage/

Difference Between Moss2007 and WSS

Today i come across a very good link which provide a brief difference between these two,


Following is the link for the difference



http://www.sharepointprovider.com/moss-hosting/compare-wss-moss.asp

Celebration for Birth of Prophet (SAW)

lets celebrate this occasion

Thursday, March 05, 2009

Cleared 70-541

On Monday 2nd march 2009, i passed Microsoft window share point services 3.0 application development 70-541,

My Experience about preparing for 70-541

  1. Buy hard cover book of Inside Microsoft Windows Share Point Services by Ted Pettison, you can easily purchased that book if your living here in Karachi Pakistan from Urdu Bazar
  2. Try to read first three, sixth and seven chapters thoroughly,you can refer to the sample codes for that book which are easily available http://www.microsoft.com/mspress/companion/9780735623200
  3. if you feel that you are getting difficulty to understand then you should see each chapter sample code and try to under every piece of code
  4. in my case i put 2 months target for that certification, as i was a beginner at that stage, try to take the exam date in advance, and for God Sake don't reschedule the certification, because the delay will erase your interest.

my next challenge is to clear the Microsoft sharepoint server 2007 Application Development 70-542 certification, i have already registered my self for that exam which is scheduled on 30th march 2009





this certification brought back some faith in myself

Sunday, November 02, 2008

Whole lot a Gap

It’s faith in something and enthusiasm for something that makes life worth living.

very good phrase.

Thursday, May 22, 2008

Terry what u have done


you have to take the blame terry

Monday, May 19, 2008

GO Blues GO

Best of luck for Champion league final

Tuesday, April 22, 2008

Monday, April 21, 2008

Hansi Khanakti Hui

Hansi Khanakti Hui
Buhji Buhji Khusihyan
Hai Dosti ki Mahak Se
Hai Rachi Hui Gharrian
Maza Anokha Sa Hai
Aate Jaate Lamhon Mein
Kitabein god Mein Phaili
Hai Khoye Baaton Mein
Rafakaton Main Khazana
Jo Hamne Paya Hain
Na Dil Pe Bojh Hai Koi
Na Gum Ka Saaya Hai


The poet is Sir Hasan Akber Kamal
Teached English in Delhi college Karachi

Tuesday, January 29, 2008

ABRAHAM LINCOLN's LETTER TO HEADMASTER

A letter written by Abraham Lincoln to the Headmaster of a school in which his son was studying. It contains an advice, which is still relevant today for executives, workers, teachers, parents and students.

A WORD TO TEACHERS

"He will have to learn, I know, that all men are not just and are not true. But teach him if you can, the wonder of books.. but also give him quiet time to ponder the eternal mystery of birds in the sky, bees in the sun and flowers on a green hillside.

In school, teach him it is far more honorable to fall than to cheat.....

Teach to have faith in his own ideas, even if everyone tells him he is wrong.

Teach him to be gentle with gentlepeople and tough with the tough.

Try to give my son the strength not to follow the crowd when everyone getting on the bandwagon...

Teach him to listen to all men; but teach him also to filter all he hears on a screen of truth, and take only the good that comes through.

Teach him, if you can, how to laugh when he is sad... Teach him there is no shame in tears.

Teach him to scoff at cynics and to be beware of too much sweetness.. Teach him to sell his brawn and brain to highest bidders, but never to put a price on his heart and soul. Teach him to close his ears to a howling mob.. and stand and fight if thinks he is right.

Treat him gently, but do not cuddle him, because only the test of fire makes fine steel. Let him have the courage to be impatient.. Let him have the patience to be brave. Teach him always to have sublime faith in himself, because then he will have faith in humankind.

This is a big order, but see what you can do. . He is such a fine little fellow my son!

- Abraham Lincoln"

Sunday, January 27, 2008

i m Right Brain

Brain Lateralization Test Results
Right Brain (56%) The right hemisphere is the visual, figurative, artistic, and intuitive side of the brain.
Left Brain (48%) The left hemisphere is the logical, articulate, assertive, and practical side of the brain
Are You Right or Left Brained?
personality tests by similarminds.com

Tuesday, January 22, 2008

Spurs 5-1 Arsenal


Arsenal Shame on you guys. got defeated from team which is standing on 9th position in premier league table

Eureka

Mushkillien itnii pardhii hum par ke assan hoogaii.


Girteey hain Shehsawar hi medaanoo mein


Inshallah i will make the difference :>