使用EWS创建扩展属性并从Outlook加载项访问它 [英] Creating extended property using EWS and access it from Outlook Add-in

查看:164
本文介绍了使用EWS创建扩展属性并从Outlook加载项访问它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在EWS上进行一些公司应用程序与Exchange 2010的集成.但是最近我尝试在创建约会时添加一些自定义/扩展属性,以下是我添加扩展属性的代码.

I am currently working on EWS to have some integration of our company application with Exchange 2010. I am using EWS to create appoinment to Exchange 2010 and it works fine; but recently I tried to add some custom/extended property when creating the appointment, below is my code to add the extended property.

Dim customField As New ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "MyCustomField", MapiPropertyType.String)

appointment.SetExtendedProperty(customField, "CustomFieldValue")

以上代码能够创建约会的自定义字段.

The above codes able to create the custom field to the appointment.

现在这是我的问题.当我在创建的Outlook中打开约会并转到开发人员>设计此表单",然后转到所有字段"选项卡时,我只看到在文件夹中的用户定义字段"中创建的自定义字段,而在此项目中的用户定义字段".

Now here is my problem. When I open up the appointment in Outlook that I created and go to "Developer > Design This Form", then "All Fields" tab, I only see the custom field I created in the "User-defined field in folder" but not in "User-defined field in this item".

当用户在Outlook中打开约会时,当我尝试查找自定义字段时,我也制作了一个Outlook加载项以响应我使用EWS创建的自定义字段,找不到自定义字段,因为自定义字段是在文件夹中的用户定义的字段"中创建的,而不是在此项目中的用户定义的字段"中创建的.

I also making an Outlook Add-in to react to the custom field that I created using the EWS when user opens up the appointment in Outlook, when I tried to look for the custom field, couldn't find the custom field, because the custom field is created in "User-defined field in folder" but not in "User-defined field in this item".

这是Outlook加载项中的代码,将在用户在Outlook中打开一个约会时执行.但是由于自定义字段不在此项目中",因此.Find()返回Nothing.

This is the codes in the Outlook Add-in and will execute when user opens an apointment in Outlook. But because the custom field is not in "in this item", the .Find() returns Nothing.

Dim appt As Outlook.AppointmentItem
appt = TryCast(inspector.CurrentItem, Outlook.AppointmentItem)
If appt.UserProperties.Find("MyCustomField") Is Nothing Then
    'Some action
Else
    'Some action
End If

我想要实现的是使用EWS使用自定义字段(扩展属性)创建约会,然后在用户在Outlook中打开约会时读取Outlook加载项中的自定义字段(扩展属性).

What I want to achieve is to create an appointment with the custom field (extended property) using EWS, and then read the custom field (extended property) in Outlook Add-in when user open the appointment in Outlook.

我使用EWS分配给自定义字段的值显示在文件夹中的用户定义的字段"中.如何从Outlook加载项中检索值?也许我可以检索该值,然后将自定义字段添加到该项目中并添加该值?

The value that I assigned to the custom field using EWS is shown in the "User-defined field in folder". How do I retrieve the value from my Outlook Add-in? Maybe I can retrieve the value and add the custom field to the item and with the value?

谢谢.

推荐答案

答案在这里: http://social.technet .microsoft.com/Forums/zh-CN/exchangesvrdevelopment/thread/2a98b4ab-0fbc-4863-8303-48711a18a050

无法使用用户属性访问EWS创建的扩展属性.但是可以使用PropertyAccessor进行访问.

Can't access the extended property created by EWS using UserProperties. But can access using PropertyAccessor.

outlookItem.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/yourProp")

这篇关于使用EWS创建扩展属性并从Outlook加载项访问它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆