Howto get SharePoint version using object model

2019-04-13 03:34发布

问题:

With WSSv2 (SharePoint 2003) you could get the version of SharePoint you were working with

e.g. SPGloablAdmin.Version gives you "12.0.0.6219" for WSSv3 SP1

However its now obsolete (although still works).

Does anyone know the WSSv3 (SharePoint 2007) equivalent?

You have things like SPWebService.ContentService.Version but that version number is just a timestamp and doesn't seem to relate back to build versions.

回答1:

SPFarm.Local.BuildVersion would probably give you the same result without having to refer to a SPWebService.

Cheers :)



回答2:

SPWebService.ContentService.Farm.BuildVersion

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spfarm.buildversion.aspx



回答3:

As maxim said, but i included it in a Powershell script http://snipt.org/nLS/