如何在sharepoint 2007中显示当前用户的收件箱

时间:2010-01-06 11:29:03

标签: sharepoint-2007 web-parts exchange-server-2007 outlook-web-app

我在Exchange 2003中找到了this web part,但在2007年的交换中,即使用户登录后,Web部件也会显示Exchange 2007 owa登录页面(而非当前用户收件箱)。

如何在moss 2007中显示当前用户的Exchange 2007收件箱?有什么想法吗?

1 个答案:

答案 0 :(得分:0)

解决方案是在开箱即用的OWA webpart周围创建一个包装器webpart,并使用当前登录用户的emailaddress访问收件箱。

这是代码

P.S。 (请注意,webaccess的地址在此处的appsettings中设置!)

using System;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Portal.WebControls;

namespace DCubed.SharePoint.WeParts
{
  /// <summary>
  /// Wrapper around the My Inbox WebPart
  /// </summary>
  public class MyInboxEx : WebPart
  {
    /// <summary>
    /// Called by the ASP.NET page framework to notify server controls that use     composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
    /// </summary>
    protected override void CreateChildControls()
    {
      // Create the instance of My Inbox Web Part 
      var inbox = new OWAInboxPart
      {
        MailboxName = SPContext.Current.Web.CurrentUser.Email,
        OWAServerAddressRoot = ConfigurationManager.AppSettings["MailServer"]
      };
      Controls.Add(inbox);
    }
  }
}