javascript 如何将 Outlook Web App 嵌入我的网站?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17472123/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 08:27:14  来源:igfitidea点击:

How i can embed Outlook Web App into my site?

javascripthtml.netasp.net-mvcoutlook

提问by ant

I want to embed Outlook Web App into my site. Show Calendar, mail, people screens directly on pages of my site. I tried to do it via iFrame, but it is forbidden. Is it possible at all?

我想将 Outlook Web App 嵌入我的网站。直接在我网站的页面上显示日历、邮件、人员屏幕。我试图通过 iFrame 来做到这一点,但它是被禁止的。有可能吗?

回答by Andreas

Contrary to common belief, this is achievable.

与普遍看法相反,这是可以实现的。

There are more details in my blogpost (http://blog.degree.no/2013/06/owa-in-iframe-yes-its-possible/) but here's the code needed. If you run it in "light mode" (flag = 1) there are less issues and it works cross domain, but if you run it within the same domain (e.g. website running on yourdomain.com and your exchange server is running on mail.yourdomain.com) it works fine for "full mode" (flag = 0) as well:

我的博文(http://blog.degree.no/2013/06/owa-in-iframe-yes-its-possible/)中有更多详细信息,但这是所需的代码。如果您在“轻型模式”(标志 = 1)下运行它,则问题较少并且可以跨域运行,但是如果您在同一个域中运行它(例如,在 yourdomain.com 上运行的网站,并且您的交换服务器在邮件上运行)。 yourdomain.com)它也适用于“完整模式”(标志 = 0):

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>

<script>
    function LoginToOWA(server, domain, username, password) {


        var url = "https://" + server + "/owa/auth/owaauth.dll";
        // flags 0 = full version, flags 1 = light weight mode
        var p = { destination: 'https://' + server + '/exchange', flags: '1', forcedownlevel: '0', trusted: '0', isutf8: '1', username: domain + '\' + username, password: password };


        var myForm = document.createElement("form");
        myForm.method = "post";
        myForm.action = url;

        for (var k in p) {

            var myInput = document.createElement("input");
            myInput.setAttribute("name", k);
            myInput.setAttribute("value", p[k]);
            myForm.appendChild(myInput);
        }


        document.body.appendChild(myForm);
        myForm.submit();
        document.body.removeChild(myForm);
    }
</script>


<body onload="javascript:LoginToOWA('mail.someserver.com','yourdomain','[email protected]','yourpassword');">
    <img src="../../gfx/loadingAnim.gif" /> Please wait while your inbox is loading... 
</body>
</html>

回答by Abhitalks

Which version of OWA are you having? I have done this before for our company's intranet on OWA-2003. Just point your iframe to the webpart url like this:

您使用的是哪个版本的 OWA?我之前在 OWA-2003 上为我们公司的内部网做过这个。只需将您的 iframe 指向 webpart url,如下所示:

http://server/exchange/user/inbox/?cmd=contents&view=Two-Line%20View&theme=4

This will work only if your main website uses Windows Integrated Authentication. You have to replace "user" with the logged in username using ASP.Net server-side code.

这仅在您的主网站使用 Windows 集成身份验证时才有效。您必须使用 ASP.Net 服务器端代码将“user”替换为登录的用户名。

Search MS KB articles for the webpart parameters. You can show inbox, calendar etc.

在 MS KB 文章中搜索 webpart 参数。您可以显示收件箱、日历等。