简体   繁体   中英

How i can embed Outlook Web App into my site?

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?

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 (eg 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:

<!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','yourusername@someserver.com','yourpassword');">
    <img src="../../gfx/loadingAnim.gif" /> Please wait while your inbox is loading... 
</body>
</html>

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:

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM