是否有 ExtendedPropertyDefinition ID 的公共枚举?

Mat*_*att 5 powershell enums exchangewebservices

就像这个问题的示例一样,我在网上看到许多代码片段在制作 ExtendedPropertyDefinition 时使用幻数。例子:

Dim PR_DELETED_ON As New ExtendedPropertyDefinition(26255, MapiPropertyType.SystemTime)
Dim PR_SEARCH_KEY As New ExtendedPropertyDefinition(12299, MapiPropertyType.Binary)
Run Code Online (Sandbox Code Playgroud)

在 MSDN 上找到了这些内容的参考位置。我可以像在一张大桌子上那样单独查找它们。这是上面示例中的类似内容PR_DELETED_ON

 +------------------------+---------------+
 | Associated properties: | PR_SEARCH_KEY |
 +------------------------+---------------+
 | Identifier:            | 0x300B        |
 +------------------------+---------------+
 | Data type:             | PT_BINARY     |
 +------------------------+---------------+
 | Area:                  | ID properties |
 +------------------------+---------------+
Run Code Online (Sandbox Code Playgroud)

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
    } 
}
Run Code Online (Sandbox Code Playgroud)

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

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

Gle*_*les 2

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