owassowebpart.cs

来自「mail web part for owa exchange integrati」· CS 代码 · 共 38 行

CS
38
字号
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.SharePoint.Portal.SingleSignon;
using Microsoft.SharePoint.Portal;

namespace OWASSOWebPart
{
    public class OWASSOWebPart : WebPart
    {
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            string strSSOLogonFormUrl = SingleSignonLocator.GetCredentialEntryUrl("OWA");
            try
            {
                writer.Write("If your login fails, please <a href=\"" + strSSOLogonFormUrl + "\">Update your credentials</a> with your new password.<br/>");
                string[] rgGetCredentialData = null;
                Credentials.GetCredentials(1, "OWA", ref rgGetCredentialData);
                string src = "/_layouts/OWARedirect.htm?l=" + rgGetCredentialData[0] + "&p=" + rgGetCredentialData[1];
                writer.Write("<iframe frameborder=\"0\" width=\"800\" height=\"600\" src=\"" + src + "\"/>");
            }
            catch (SingleSignonException ssoe)
            {
                if (SSOReturnCodes.SSO_E_CREDS_NOT_FOUND == ssoe.LastErrorCode)
                {
                    Context.Response.Redirect(strSSOLogonFormUrl);
                }
                else
                {
                    writer.Write(ssoe.Message);
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?