代码改变世界

MOSS 2013研究系列---不常用函数总结……

2013-05-10 11:46  温森特  阅读(668)  评论(1编辑  收藏  举报

 

获取MOSS网站集的数据库信息:

//
            SPWebApplication webapp = SPWebApplication.Lookup(new Uri("http://cn-pekappdev020:8080"));
            SPDatabase db = webapp.ContentDatabases[0];
            string dbconn = db.DatabaseConnectionString;
//

 获取MOSS的Site网站模板信息:

//Namespace:  [Sites Web service]
//Web service reference: http://Site/_vti_bin/Sites.asmx


       Site8080.Sites sites = new Site8080.Sites(); sites.Credentials = System.Net.CredentialCache.DefaultCredentials; Site8080.Template[] t; sites.GetSiteTemplates(1033, out t); foreach (Site8080.Template template in t) { string strDisplay = "Title: " + template.Title + " Name: " + template.Name + " Description: " + template.Description + " IsCustom: " + template.IsCustom + " ID: " + template.ID + " ImageUrl: " + template.ImageUrl + " IsHidden: " + template.IsHidden + " IsUnique: " + template.IsUnique + "\n\n"; Console.WriteLine(strDisplay); }

 根据Site模板创建Site站点集:

PWebApplication webApp = new SPSite("http://MySiteCollection").WebApplication;
SPSiteCollection siteCollections = webApp.Sites;

SPSite newSiteCollection = siteCollections.Add("sites/Site_Name", 
    "Site_Title", "Site_Description", 1033, "STS#0", 
    "DOMAIN\\Owner", "Owner_Display_Name", 
    "Owner_Email", "DOMAIN\\Contact", 
    "Contact_Display_Name", "Contact_Email");
 

默认站点模板:

Value

Site Definition

STS#0

Team Site

STS#1

Blank Site

STS#2

Document Workspace

MPS#0

Basic Meeting Workspace

MPS#1

Blank Meeting Workspace

MPS#2

Decision Meeting Workspace

MPS#3

Social Meeting Workspace

MPS#4

Multipage Meeting Workspace

BLOG#0

Blog

SGS#0

Basic Group Work Site

SGS#1

Blank Group Work Site

WIKI#0

Wiki