Reputation: 775
I've deployed a Wopi client as mentioned in the documentation and now i'm trying to deploy a wopi host, but i'm new to .net enviroment and i don't know how to get the file hosted in wopi-docs folder. (It seems to be encrypted but i don't know how to get the files in that folder)
I have done the next steps:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<!-- Enable IE Standards mode -->
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<link rel="shortcut icon" href="https://my-server-url.com/wv/resources/1033/FavIcon_Word.ico" />
<style type="text/css">
body {
margin: 0;
padding: 0;
overflow: hidden;
-ms-content-zooming: none;
}
#office_frame {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: 0;
border: none;
display: block;
}
</style>
</head>
<body>
<form id="office_form" name="office_form" target="office_frame" action="https://my-server-url.com/wv/wordviewerframe.aspx?ui=es-mx&rs=es-mx&dchat=1&showpagestats=1&IsLicensedUser=1&WOPISrc=http%3A%2F%2Fmy-server-url.com%3A5000%2Fwopi%2Ffiles%2Ftest.docx" method="post">
<input name="access_token" value="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxMjM0NSIsInVuaXF1ZV9uYW1lIjoiQW5vbnltb3VzIiwiZW1haWwiOiJhbm9ueW1vdXNAZG9tYWluLnRsZCIsIlVzZXJQZXJtaXNzaW9ucyI6IlVzZXJDYW5BdHRlbmQsIFVzZXJDYW5QcmVzZW50LCBVc2VyQ2FuUmVuYW1lLCBVc2VyQ2FuV3JpdGUiLCJuYmYiOjE2MTA2MDU5NDgsImV4cCI6MTYxMDYwOTU0OCwiaWF0IjoxNjEwNjA1OTQ4fQ.KbxGcTVOa3yWCGcEHEGv9MRP_NskfViW_vyMTOupRO4" type="hidden" />
<input name="access_token_ttl" value="0" type="hidden" />
</form>
<span id="frameholder"></span>
<script type="text/javascript">
var frameholder = document.getElementById('frameholder');
var office_frame = document.createElement('iframe');
office_frame.name = 'office_frame';
office_frame.id = 'office_frame';
// The title should be set for accessibility
office_frame.title = 'Office Frame';
// This attribute allows true fullscreen mode in slideshow view
// when using PowerPoint's 'view' action.
office_frame.setAttribute('allowfullscreen', 'true');
// The sandbox attribute is needed to allow automatic redirection to the O365 sign-in page in the business user flow
office_frame.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-forms allow-popups allow-top-navigation allow-popups-to-escape-sandbox');
frameholder.appendChild(office_frame);
document.getElementById('office_form').submit();
</script>
</body>
</html>
And the result that i get is the following error:
Does anyone know how to get the correct name of the files to put into the html file above or how do i get the wopi host web?
Thanks in advance.
Upvotes: 0
Views: 680
Reputation: 7696
The file ID in my repo is just base64 encoded. To verify that you're using the correct path, just take the base64 value and pass it to a decoder or write your own utility to decode it. The ID should be opaque to the WOPI client (Office Online Server) - it accepts it an passess it back to the WOPI host which can undertand it and return the right file. I recommend putting breakpoints to GetCheckFileInfo and GetFile methods to see if they're being hit correctly and what data they return.
Upvotes: 0