Search code examples
c#developer-toolsnetoffice

Netoffice Hello World


I used VSTO a couple of years ago with Visual Studio to do some nice little addins for outlook. But I can't justify the cost of VS to do some part time projects. As a result I have installed the free version of VS and downloaded a promising office addin tool called NetOffice.

I am ok at c# but can't find a hello world example that includes setting up the environment to work.

I have VS express installed but don't know what to do with the NetOffice assemblies etc to get a simple example working.

I looked through the documentation and found a reference to "Netoffice Developer Toolbox" which set up projects for people who are not using the full version of VS. That sounded like exactly what I was after so I downloaded that also.

When I run the app NetOffice.DeveloperToolbox.exe I get a lot of errors, it does eventually load but tabs are missing and nothing seems to work.

Start up error is:

An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information. | NotSupportedException | Void .ctor()

Following the link in the error message takes you to a page that has this description:

If you were directed to this topic because of an error message in the Visual Studio project error list or a build error, see How to: Use an Assembly from the Web in Visual Studio.

I didn't know i was referencing anything in the web so don't know what to do next.

Can anyone tell me what I need to do to get NetOffice working or if they have found/written a tutorial to getting it sorted IE a hello world tutorial?

Thanks in advance for your help.


Solution

  • you try to start a .net assembly from a network location. this is forbidden from net policies(normaly) move the toolbox folder to your hd and everything is okay.

    NetOffice contains examples/tutorials for each office product in the release package. you find a lot of example online too directly from the main page(netoffice.codeplex.com) anyway, NetOffice is a 1:1 wrapper, this means if you already know the office object model from VBA or PIA(VSTO), you are ready to use NetOffice(you can use existing PIA code in NetOffice).