从 EWS 访问 Outlook 用户属性
我正在尝试创建一个使用 EWS api 访问联系人的应用程序。
我需要在此过程中查看 Outlook 用户属性之一,但我不知道如何使用 EWS 获取它。目前我刚刚尝试过...
service.Url = new Uri("https://url/ews/Exchange.asmx");
service.Credentials = new WebCredentials("credentials");
var results = service.FindItems(folderId, new ItemView(100));
foreach (var item in results)
{
Contact contact = item as Contact;
foreach (var prop in contact.ExtendedProperties)
{
Console.WriteLine(prop.Value.ToString());
}
}
编译和执行没有问题,但对于每个联系人,ExtendProperties 计数为 0,在 Outlook 中约为 30。
那么我怎样才能获得我正在寻找的属性呢?
仅供参考。我正在使用 exhcnage 2007。
谢谢。
I'm trying to create an application that use the EWS api to access contacts.
I need to look at one of the outlook user properties in this process but I cant see how to get it at using EWS. At the moment ive just tried...
service.Url = new Uri("https://url/ews/Exchange.asmx");
service.Credentials = new WebCredentials("credentials");
var results = service.FindItems(folderId, new ItemView(100));
foreach (var item in results)
{
Contact contact = item as Contact;
foreach (var prop in contact.ExtendedProperties)
{
Console.WriteLine(prop.Value.ToString());
}
}
Which compiles and executes without a problem, but for every contact the ExtendedProperties count is 0 which in outlook its about 30.
So how can I get the properties I'm looking for?
Just an FYI. Im using exhcnage 2007.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要定义想要获取的属性 - EWS 不允许您枚举用户属性。
Userproperties 位于命名空间 PublicStrings 中。
然后,您可以在 FindItems 请求中使用该定义:
You need to define the properties you want to get - EWS does not permit you to enumerate user properties.
The Userproperties are in the namespace PublicStrings.
You can then use the definition in a FindItems request:
我也遇到同样的问题,解决了。
myCustomPropOne & myCustomPropTwo 是您在 Outlook/editor 中设置的用户定义属性的名称。 参考
I had the same problem, solved.
myCustomPropOne & myCustomPropTwo are names of user defined properties you set in outlook/editor. ref