Outlook ContactItem属性 - 从MailItem访问ContactItem作为附件时 [英] Outlook ContactItem properties - when access ContactItem from a MailItem as attachement

查看:122
本文介绍了Outlook ContactItem属性 - 从MailItem访问ContactItem作为附件时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一般:


我有一个自定义的表单区域,只要检测到contactitem就会加载。这在直接打开联系人项目时非常有效,表单区域加载然后我从自定义项属性中读取一些数据以分别加载到自定义表单区域


挑战:


我面临的困难是联系人项目存储在电子邮件中。例如见下面的图片:


所以这是一个邮件物品,其中有一张联系卡作为附件。


这样会很好,因为表格区域仍然分别在底部加载,因为您可以看到以红色突出显示。这意味着在FormRegion Load上仍然可以挂钩到被识别为联系人项目(而不是mailItem)的当前项目!



 下面的代码显示表单区域加载并点击


----------- ------ CODE SNIPPET BEGIN -----------------



//在显示表单区域之前发生。


//
使用this.OutlookItem获取对当前Outlook项的引用。


//
使用此选项。 OutlookFormRegion获取对表单区域的引用。


私人
void FB_Pannel_FormRegionShowing( 对象
sender,System。
EventArgs
e)


{



    如果 。OutlookItem

ContactItem < font size ="2"face ="Consolas">)


      {



&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; var
item =
。 OutlookItem
as
ContactItem ;



       var
FullName = item.FullNameAndCompany;



< font color ="#0000ff"size ="2"face ="Consolas">        var
Property = item.ItemProperties [
" FBItemProperty" ]。值;


      //在使用此属性值进行数据库查询时,会显示在表格区域中。



     }


...




}





------------ ----- CODE SNIPPET END -----------------


问题是FullName是可访问的,但是的&NBSP; ItemProperties不是。我在上面设置的Itemproperties值上得到一个对象null异常。


但是,如果我双击并打开邮件Item中的联系人,那么ItemProperty是可见的,并且返回的值为服务直到表单区域控件,一切正常。


关于如何访问这些属性的任何想法,我也尝试过Application.ItemLoad事件,但后来我无法进入Item该事件模型的属性。


 


PS对不起,拼写输入速度更快......


问候


詹姆斯


 

解决方案

这是图像。



General:

I have a custom form region that loads whenever a contactitem is detected. This functions perfectly when opening a contact item directly, the Form region loads and then I read some data from a Custom item property to load into the custom form region respectively.

The Challenge:

The difficulty I am facing is when the contact item is stored in a email message. For example see picture bellow:

So this is a Mail Item that has a contact card as an attachement.

This would be fine because the Form Region still loads respectively at the bottom as you can see highlighted in red. This means that on FormRegion Load and can still hook into the current Item that is recognised as a contact item (not a mailItem)!

 The code bellow shows the form region loading and hitting the

----------------- CODE SNIPPET BEGIN -----------------

// Occurs before the form region is displayed.

// Use this.OutlookItem to get a reference to the current Outlook item.

// Use this.OutlookFormRegion to get a reference to the form region.

private void FB_Pannel_FormRegionShowing(object sender, System.EventArgs e)

{

     if (this.OutlookItem is ContactItem)

     {

      var item = this.OutlookItem as ContactItem;

      var FullName = item.FullNameAndCompany;

      var Property = item.ItemProperties["FBItemProperty"].Value;

      //DOES SOMETHING TO QUERY FROM A DATABASE USING THIS PROPERTY VALUE THEN DISPLAYS IN FORM REGION.

     }

...

}

----------------- CODE SNIPPET END -----------------

The problem is that the FullName is accessible, but the  ItemProperties are not. I get a object null exception on the Itemproperties value as set above.

However if I double click and open the contact from the mail Item, then the ItemProperty is visible and the value returned for serving up to the Form Region controls and everything works fine.

Any ideas on how I can access these properties, I have also tried the Application.ItemLoad event, but then I can not reach into Item properties on that Event model.

 

P.S Sorry for the spelling typing extra fast...

Regards

James

 

解决方案

Here is the image.


这篇关于Outlook ContactItem属性 - 从MailItem访问ContactItem作为附件时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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