For prawns, skip this step.
Basic preparations
1. sharepoint2007 Object Model Series
Generally, developers or beginners may be exposed to spsite-level objects.
Spfarm, spservice, spapplicationpool, spwebapplication, and spfeaturedefinition and spsolution among others.
2. Management object model for Windows SharePoint Services 3.0
References from msdn,
The layer structure of WSS is described in the following aspects:
Content hierarchy of Windows SharePoint Services
Content hierarchy of Windows SharePoint Services
Service hierarchy of Windows SharePoint Services
3. How to create new application pool and change app pool of SharePoint website
What we need to know here is that the application pool created directly from IIS will not be recognized by Sharepoint.
Logic 2
1. Create an application pool --> 2. Create an application --> 3. Create a website)
It is troublesome to create an application.
1. Create an application pool (spapplicationpool)
Create application assembly
Public spapplicationpool createnewpool (string poolname)
{
Spwebservice WebService = farm. Services. getvalue <spwebservice> ();
Spapplicationpool pool = new spapplicationpool (poolname, WebService );
Pool. currentidentitytype = identitytype. specificuser;
Pool. Username = @ "sharepoint2007 \ mossadmin ";
Pool. Password = "ABC-*/123 ";
Pool. Update ();
Pool. Deploy ();
Return pool;
}
2. Create an application
Code
Public spwebapplication createwebapplication (string appname, spapplicationpool pool)
{
Int Port = 2005;
Spwebapplicationbuilder webappblder = new spwebapplicationbuilder (farm );
// Set IIS Site attributes:
Webappblder. ID = guid. newguid ();
Webappblder. Port = port;
Webappblder. rootdirectory = new system. Io. directoryinfo (@ "C: \ Inetpub \ wwwroot \ WSS \ virtualdirectories \" + port. tostring ());
// Set the properties of the application pool:
// Specify the name of the IIS application pool, the access user name, And the password.
Webappblder. applicationpoolid = "your application pool name ";
// Web Application Security Settings:
// NTLM authentication is set here, and NTLM and Kerberos authentication methods are used in Sharepoint. Kerberos is relatively more complex. Do not use SSL or allow anonymous access
Webappblder. usentlmexclusively = true;
Webappblder. allowanonymousaccess = false;
Webappblder. usesecuresocketslayer = false;
// Set the Server Load balancer URL:
Webappblder. defaultzoneuri = new uri ("http: // mossserver: 2005 ");
// Set the database attributes of the Web application:
// Here, the database username is set to null, indicating that Windows integrated authentication is used.
Webappblder. createnewdatabase = true;
Webappblder. databaseserver = "mossserver ";
Webappblder. databasename = "testapp2005 ";
Webappblder. databaseusername = string. empty;
// Create a web application:
// Create a web application in the server farm of SharePoint
Spwebapplication webapp = webappblder. Create ();
// Set the general attributes of the Web application:
// Here, the time zone 45 indicates GMT + Beijing Time Zone
// The configuration here is mainly used to simulate the configuration in <general settings of Web Applications> In the SharePoint Management Center
Webapp. defaulttimezone = 45;
Webapp. Name = appname;
Webapp. Update ();
// Create an IIS Web application and application pool:
Webapp. Provision ();
Return webapp;
}
3. Create a website set
Public spsite createsite (spwebapplication webapp, string siteurl)
{
Return webapp. sites. Add (siteurl, "", "", 2052, "BDR #0", @ "sharepoint2007 \ mossadmin", "", "mossadmin@hh.com ");
}
BDR #0 is the website template. For details, refer to here.
I hope this will help you and me.