After obtaining an instance of SPFarm, you can browse and manage servers and services thatbelong to that farm. For example, you can browse the Servers collection to enumerate all the physicalserversthatbelongto thefarmasobjectsof typeSPServer.YoucanbrowsetheServicesproperty,whichhasthetypeSPServiceCollectionandcontainsdifferentkindsof services—allsharinga commonbaseclassof typeSPService.YoucanexaminealltheWindowsservices,whichareobjectsof typeSPWindowsService,oryoucanaccessthewebservices,whichareof typeSPWebService.Everywebserviceiscomposedof oneormorewebapplications,eachwiththetypeSPWebApplication.Listing5-1showsa codeexamplethatbrowsesforallthesekindsof objectsin thelocalfarm.Notethatyoushouldexecutethis(andthefollowing)codeexcerptin a projectthatreferencestheMicrosoft.SharePoint.dllassembly,andyoushouldalsoprovidea usingstatementforMicrosoft.SharePoint,aswellasforMicrosoft.SharePoint.Administration.
đang được dịch, vui lòng đợi..
