代码改变世界

工作小记

2010-10-29 14:03  轩脉刃  阅读(289)  评论(0编辑  收藏  举报

C#中使用PowerShell:
 Process process = new Process();
 // Redirect the output stream of the child process.
 process.StartInfo.UseShellExecute = true;
 process.StartInfo.FileName = "powershell";
 process.StartInfo.Arguments = @".\Build-TestSuite.ps1 " + BuildDestFolder + " " + protocol.ShortName + " " + protocol.Family;
 process.Start();
 
// Wait for exit
 process.WaitForExit();
 ----------------------------------------------------


sharepoint的数据库结构:
 Using these procedures, the DBA will create databases and the farm administrator will perform other configuration actions in the following order:
 1. · The configuration database (only one per farm).
 2. · The content database for Central Administration (only one per farm).
 3. · Central Administration Web application (only one per farm, created by Setup).
 4. · The Windows SharePoint Services search database (only one per farm).
 5. · Start the Office SharePoint Search service.
 For each portal site:
 6. · Portal site Web application content database.
 For each SSP:
 7. · A content database for the My Sites Web application (if the SSP is using its own Web application).
 8. · A content database for the Shared Services Administration Web application (if the SSP is using its own Web application).
 9. · SSP Search database (one per SSP).
 10. · SSP Web application (created by Setup if the SSP is using its own Web application).
 Note:
As part of the Web site and application pool creation process, a Web application is also created in Internet Information Services (IIS). Extending a Web application will create an additional Web site in IIS, but not an additional application pool.
 
private bool ExtractCabinet()
 {
 bool extractStatus = false;
 
try
 {
 System.Diagnostics.Process extractor = new System.Diagnostics.Process();
 extractor.StartInfo.UseShellExecute = true;
 extractor.StartInfo.CreateNoWindow = true;
 extractor.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
 extractor.StartInfo.FileName = "extrac32.exe";
 extractor.StartInfo.Arguments = "/e /l " + this.targetLocation + " " + this.parserLocation + "dp.cab";
 
if (extractor.Start())
 extractStatus = true;
 }
 catch (Exception)
 { }
 
return extractStatus;
 }
 -------------------------------

Sharepoint 的dll在:
 C:\program files\common files\microsoft shared\web server extensions\12\isapi
 ------------------------

Workflow 指的是“工作流(Workflow)就是“业务过程的部分或整体在计算机应用环境下的自动化”,它主要解决的是“使在多个参与者之间按照某种预定义的规则传递文档、信息或任务的过程自动进行,从而实现某个预期的业务目标,或者促使此目标的实现”。
 
http://tech.ddvip.com/2009-11/1257623583137772.html
 

-----------------------------------
Create and Publish web pages in Publishing SharePoint sites programmatically
 using (SPSite site = new SPSite("http://moss"))
 {
 using (SPWeb web = site.OpenWeb())
 {
 PublishingSite pSite = new PublishingSite(site);
 SPContentType ctype = pSite.ContentTypes["Welcome Page"];
 PageLayoutCollection pageLayouts = pSite.GetPageLayouts(ctype, true);
 PageLayout pageLayout = pageLayouts["/_catalogs/masterpage/welcomesplash.aspx"];
 PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(web);
 PublishingPageCollection pPages = pWeb.GetPublishingPages();
 PublishingPage pPage = pPages.Add("Programmatic_Test.aspx", pageLayout);
 SPListItem newpage = pPage.ListItem;
 newpage["Title"] = "Page added programmatically";
 newpage.Update();
 
newpage.File.CheckIn("all looks good");
 newpage.File.Publish("all looks good");
 }
 }
 -----------------------------
用code判断一个webservice是否是正确的:
 利用 HttpWebRequest.GetResponse() 后检查其 StatusCode,不大于 400 则可判断此 URL 服务有效。 try {
 // Create a web request for an invalid site. Substitute the "invalid site" strong in the Create call with a invalid name.
 HttpWebRequest myHttpWebRequest = (HttpWebRequest) WebRequest.Create("invalid site");
 
// Get the associated response for the above request.
 HttpWebResponse myHttpWebResponse = (HttpWebResponse) myHttpWebRequest.GetResponse();
 myHttpWebResponse.Close();
 }
 catch(WebException e) {
 Console.WriteLine("This program is expected to throw WebException on successful run."+
 "\n\nException Message :" + e.Message);
 if(e.Status == WebExceptionStatus.ProtocolError) {
 Console.WriteLine("Status Code : {0}", ((HttpWebResponse)e.Response).StatusCode);
 Console.WriteLine("Status Description : {0}", ((HttpWebResponse)e.Response).StatusDescription);
 
}
 

 ----------------------------------

查看sharepoint的log:
 Central Administration > Operations > Diagnostic Logging

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS
 

------------------------------
Sharepoiont designer 2007 对应server 2007
 2010 对应10
 
-----------------------------
 
多线程debug:
 http://channel9.msdn.com/posts/DanielMoth/Multi-threading-Debugging-Enhancements-in-Visual-Studio-2008/
 
debug—>windowsàthread
 

------------------------------
adding an extra server to an existing sharepoint farm:
 http://sharepointnotes.wordpress.com/2008/01/10/adding-an-extra-server-to-an-existing-sharepoint-farm/
 Install MOSS and join the server to the existing farm
 1.Install using the MOSS installation account
 2.Start MOSS Setup, enter your license key and accept the license agreement
3.Select Advanced and Complete install
 4.Run the SharePoint Product and Technologies Configuration Wizard
5.Connect to an existing farm
 6.Enter the MOSS database server end click Retrieve Database Names. The Database Name and Username fields are automatically populated. Enter the password and click Next
7.In Advanced Setting make sure that this server will not host the Central Administration site and click Next
 8. That’s it. The new server is now member of the farm. Use Central Administration to configure it for the purpose it is intended (Web Front-end, indexing etc)


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yjf512/archive/2010/02/24/5321839.aspx