Is is possible to use OpenXML in SandBox.


WordprocessingDocument myDoc = WordprocessingDocument.Open(mem, true); 

The above class WordprocessingDocument is giveing error as


The type 'System.IO.Packaging.Package' is defined in an assembly that is not referenced. You must add a reference to assembly 'WindowsBase, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

No, this is not possible in the SharePoint Sandbox. You can't reference other DLL's and if you used the OpenXml source code you would still get problems since it uses namespaces in .Net which are not allowed in the Sandbox.


Contrary to my original comments, I have verified that this does not work in Office 365, however it does work in On Premise SharePoint 2010 Sandbox. Anyone interested in doing this in SharePoint 2010 sandbox can take a look at my post here: http://blog.johnnybouder.com/post/2012/03/25/OpenXML-in-the-Sandbox.aspx

  • In your case you've already installed the OpenXML binaries on the server, so it's not a fully sandboxed solution, right!? Mar 29 '12 at 12:34
  • Also this q is tagged with SharePoint Online - you can't do any installs there :) Mar 29 '12 at 12:50
  • Nope, I didn't install the binaries on the server. They are technically on my development laptop, but it has not been installed on the destination environments servers. That's why I'm including the binaries in the WSP so they are local to the sandbox solution.
    – user7796
    Apr 10 '12 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.