Wednesday, 15 January 2014

c# - Retrieving explorer window object in Outlook Ribbon extension on startup? -



c# - Retrieving explorer window object in Outlook Ribbon extension on startup? -

i having problems attempting retrieve default inbox folder because have no instance retrieve from.

ultimately, i'm attempting retrieve list of mail service items 1 year or more old, such can display these mails in form , allow user know these mails expire either move them, save them, or deleted. there new corporate e-mail rentention policy deletes emails after 1 year , doesn't allow users know.

before can however, need list of mailitems. when outlook begins, outlook calls next code:

/// <summary> /// overridden method allow outlook , load extensions. /// </summary> /// <returns>a <see cref="mailexpiryalert"/> class containing extension logic</returns> protected override office.iribbonextensibility createribbonextensibilityobject() { if (application.explorers.count > 0) { string breakpoint = "this break point never reached on initial startup"; } homecoming new mailexpiryalert(); }

however, next error: nullreferenceexceptoin: object reference not set instance of object. because explorer window hasn't loaded yet, , hence null. however, how supposed load extension (it depends on explorer , folders within) before outlook loads? know i'm missing simple here help appreciated.

you need application.session.getdefaultfolder(olfolderinbox), not matter whether there active explorers or not.

c# outlook vsto outlook-2010

No comments:

Post a Comment