【问题标题】:Are there publics Enums for ExtendedPropertyDefinition IDs?ExtendedPropertyDefinition ID 是否有公共枚举?
【发布时间】:2017-06-13 16:37:04
【问题描述】:

就像this question 的示例一样,我在 Web 上看到许多代码 sn-ps 在制作 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 中为此寻找一个枚举。我写这个 sn-p 是为了(希望)向我展示所有暴露的枚举。

$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
    } 
}

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

不是世界末日,但我自己找不到它们。或许可以解释为什么代码 sn-ps 一直引用它们。

【问题讨论】:

  • 我猜语义名称仅存在于 C++ 标头中,而编译的应用程序使用裸数字。虽然您可以尝试在 windows、outlook、office、公共文件夹中搜索 PR_SEARCH_KEY 等。
  • 不知道有没有用,但在一些商业库中存在Aspose

标签: powershell enums exchangewebservices


【解决方案1】:

不,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(但这些只是标记的属性)。

【讨论】:

  • 最近到处见到你。喜欢你的博客。感谢您的构象
猜你喜欢
  • 2017-12-24
  • 1970-01-01
  • 2011-05-13
  • 2013-12-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多