Freigeben über


Example code

Sample WOPI host

The Office for the web GitHub repository contains a sample implementation of a WOPI host written in C#. This sample implementation illustrates many of the concepts necessary to implement a WOPI server, including:

Proof key unit tests

Example test cases and data that can be used to validate proof key verification implementations can be found here: https://github.com/Microsoft/Office-Online-Test-Tools-and-Documentation/blob/master/samples/SampleWopiHandler/SampleWopiHandler.UnitTests/ProofKeyTests.cs

While these tests are written in C#, they can be adapted to any language. If you are having difficulties implementing proof keys, these test cases can be a useful tool for troubleshooting. See also the Troubleshooting proof key implementations section.

These same test cases along with basic proof key validation implementations are available in both Java and Python:

Note that the Python samples depend on PyCrypto being installed.