天天看點

工作小記

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)就是“業務過程的部分或整體在計算機應用環境下的自動化”,它主要解決的是“使在多個參與者之間按照某種預定義的規則傳遞文檔、資訊或任務的過程自動進行,進而實作某個預期的業務目标,或者促使此目标的實作”。

<a href="http://tech.ddvip.com/2009-11/1257623583137772.html">http://tech.ddvip.com/2009-11/1257623583137772.html</a>

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

create and publish web pages in publishing sharepoint sites programmatically

 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 &gt; operations &gt; diagnostic logging

c:\program files\common files\microsoft shared\web server extensions\12\logs

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

sharepoiont designer 2007 對應server 2007

 2010 對應10

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

多線程debug:

debug—&gt;windowsàthread

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)