how to show current user's inbox in sharepoint 2007

£可爱£侵袭症+ 提交于 2020-01-16 04:30:26

问题


I found this web part for Exchange 2003, but in exchange 2007 even after user login, web part shows exchange 2007 owa login page (instead of current user inbox).

How I can show current user's exchange 2007 inbox in moss 2007? Any Idea?


回答1:


The solution is to create a wrapper webpart around the out of the box OWA webpart and have that access the inbox by using the currently logged in user's emailaddress.

Here's the code

P.S. (note that the address of the webaccess is set in the appsettings here!)

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);
    }
  }
}


来源:https://stackoverflow.com/questions/2012539/how-to-show-current-users-inbox-in-sharepoint-2007

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!