ServerVersion (POX)
ServerVersion 元素表示运行Microsoft Exchange Server的计算机的版本号。
<ServerVersion/>
属性和元素
下面各部分介绍了属性、子元素和父元素。
Attributes
无。
子元素
无。
父元素
元素 | 说明 |
---|---|
Protocol (POX) |
包含用于将客户端连接到运行安装了客户端访问服务器角色的 Microsoft Exchange 的计算机的规范。 |
文本值
文本值表示 Exchange 服务器版本号。
备注
仅当 TYPE (POX) 元素等于 EXCH 或 EXPR 时,ServerVersion 值才有效。 ServerVersion 值是包含服务器的 MajorVersion、MinorVersion 和 MajorBuildNumber 的十六进制数。
示例
以下示例覆盖自动发现响应中返回的 ServerVersion 值,以获取并显示 MajorVersion、MinorVersion 和 MajorBuildNumber。 此示例允许你为 ServerVersion 值输入十六进制值。 如果未输入 ServerVersion 值,则使用默认 的 ServerVersion 值 738180DA。
static void Main(string[] args)
{
// Convert a ServerVersion value that is returned from an Autodiscover request.
// The value is a hex value and can be converted to the MajorVersion, MinorVersion,
// and MajorBuildNumber.
Console.WriteLine("Enter ServerVersion returned from the Autodiscover (eg. 738180DA) and Enter.");
Console.WriteLine("To use the default ServerVersion of 738180DA, just hit Enter.");
// Get the hexadecimal ServerVersion value.
string serverversionhex = Console.ReadLine();
// If nothing is entered, use the default server version of "738180DA"
if (serverversionhex == "")
{
serverversionhex = "738180DA";
}
Console.WriteLine("ServerVersion (Hex) = " + serverversionhex);
string serverversionbinary = Convert.ToString(Convert.ToInt32(serverversionhex, 16), 2);
// The ServerVersion (binary) should be 32 bits in length. If the
// server version in binary is a length of 31 characters, the leading
// zero has been removed in the conversion process. Put the missing zero back.
if (serverversionbinary.Length == 31)
{
serverversionbinary = String.Concat("0", serverversionbinary);
}
Console.WriteLine("ServerVersion (bin) = " + serverversionbinary);
// The first 4 bits represent a number used for comparison against
// older version number structures. You can ignore this.
// The next 6 bits represent the major version number.
int majorversion = Convert.ToInt32(serverversionbinary.Substring(4, 6), 2);
Console.WriteLine("MajorVersion: " + majorversion);
// The next 6 bits represent the minor version number.
int minorversion = Convert.ToInt32(serverversionbinary.Substring(10, 6), 2);
Console.WriteLine("MinorVersion: " + minorversion);
// The next bit represent a flag - you can ignore this.
// The next 15 bits represent the major build number.
int majorbuild = Convert.ToInt32(serverversionbinary.Substring(17, 15), 2);
Console.WriteLine("MajorBuildVersion: " + majorbuild);
Console.WriteLine("\n\nPress any key to continue");
Console.ReadKey();
}