是否存在针对ExtendedPropertyDefinition ID的公共枚举?

时间:2017-01-27 21:37:20

标签: powershell enums exchangewebservices

this question中的示例非常相似我在制作ExtendedPropertyDefinition时使用幻数在网络上看到了很多代码段。例如:

Dim PR_DELETED_ON As New ExtendedPropertyDefinition(26255, MapiPropertyType.SystemTime)
Dim PR_SEARCH_KEY As New ExtendedPropertyDefinition(12299, MapiPropertyType.Binary)

有点找到reference location for these on MSDN。我可以将它们单独看作一张大桌子。以下是上面示例中PR_DELETED_ON的内容

 +------------------------+---------------+
 | Associated properties: | PR_SEARCH_KEY |
 +------------------------+---------------+
 | Identifier:            | 0x300B        |
 +------------------------+---------------+
 | Data type:             | PT_BINARY     |
 +------------------------+---------------+
 | Area:                  | ID properties |
 +------------------------+---------------+

0x300b为十进制的12299

我讨厌魔术数字,所以我在EWS API中寻找一个枚举。我写了这个片段(希望)向我展示所有暴露的枚举。

$obj = [Reflection.Assembly]::LoadFile("C:\Program Files (x86)\EWSManagedAPI\Microsoft.Exchange.WebServices.dll")
$obj.GetTypes() | Where-object{$_.isenum -and ($_.ispublic -or $_.isnestedpublic)} | ForEach-Object{
    $props = @{Name = $_.FullName}
    [enum]::GetValues($_) | ForEach-Object{
        $props.Integer = [int64]$_ 
        $props.Text = $_
        [pscustomobject]$props
    } 
}

我没有看到输出中与我上面看到的相符的任何内容。有谁知道这些属性是否存在预先存在的枚举?如果不是这样的话。我只是假设那里会有一些东西。

不是世界末日,但我自己也找不到它们。可能会解释为什么代码片段会继续引用它们。

1 个答案:

答案 0 :(得分:2)

EWS托管API中没有任何内容,AFAIK没有由Microsoft维护的主列表。还有不同类型的属性,例如Tagged和Named属性,要在EWS中使用Extended属性,您需要首先定义并告诉Exchange返回或设置该属性,以便EWS不允许您枚举所有Extended属性在像MAPI这样的项目上。我所知道的最接近的列表是来自EWSEditor的一个非常全面的https://ewseditor.codeplex.com/SourceControl/latest#EWSEditor/PropertyInformation/KnownExtendedPropertiesData.cs。 Mapi包含文件也有一个很好的列表,例如https://github.com/openchange/openchange/blob/master/properties_enum.h(但这些只是标记属性)。