Home >System Tutorial >Windows Series >Five Common Office API Error Codes and What They Mean
Office Add-ins allow you to extend your standard Microsoft Office solution into something more. Something that can change how you do business or streamline your Office apps to suit your needs. But taking advantage of them means learning how to create Office APIs, and with that comes the potential for errors. Several of them, in fact, which is why we’ve compiled some of the most common Office API error codes and what you should do when you encounter them.
When we say “common,” we mean error codes that you might come across while working within the Common API model. These aren’t application-specific error codes, as you might encounter when working with the Word JavaScript API, for instance. Here are some you should pay attention to.
Error.code 1000 tells you that you have an invalid coercion type somewhere in your code. Excel gives us a good example here. Excel doesn’t support either the HTML or OOXML coercion types, making this code guaranteed if you try to force it. If you don’t already know, type coercion is the process apps follow to convert one object type to another. If there’s a conflict in that conversion, you’re likely to see this error code.
This is an easy error code to draw out because it deals with data objects. The larger those objects get, the more chance one of them ballooning beyond the data limits you’ve defined in your Office application. If you see this code, the solution is to shrink down the data object causing the problem.
Any coder can tell you that setting names for objects is key to getting a program running properly. If you don’t do that, you’re liable to run into error.code 4000. You get this code when you specify a setting name that doesn’t exist anywhere inside your API code.
Permission denied!
That’s the message you’re receiving when you see this error code. It tells you that you – as the solution developer – are attempting to submit an operation using a document that doesn’t give you the appropriate permissions. You’ll see this a lot if you’re using documents in which you restrict editing.
Connection errors happen. When they do, you won’t be able to save your item to the server. That’s what error.code 9021 tells you – there’s a connection error somewhere in your setup that you need to fix. For instance, problems with “Online Mode” when using Outlook Desktop can trigger this error.
We’ve only touched on a handful of the common Office API error codes you might encounter in your development career. Each has individual fixes that involve you figuring out where your code went wrong and what you have to do about it. But there are a couple of quick potential fixes you can try across all of the codes.
Your firewall might be getting in the way of the application you’re trying to run. Turning it off, or verifying the firewall’s settings so it’s not trying to block the program you’ve created, could give you a quick fix.
Step 1. Type “Windows Security” into the search bar at the bottom of your screen and click the icon with the same name.
Step 2. Select “Firewall & network protection” from the options on the left and scan your various domains to see their firewall settings. Turning off your domain or private networks may get your API code up and running.
Step 3. Alternatively, click “Allow an app through firewall” and grant the app you’ve created permission to break through your Windows firewall.
If you get any web-related errors concerning the properties you define, Microsoft Edge running in compatibility mode may be the problem. Here’s how to turn it off.
Step 1. Click on the ellipses – the “…” symbol – at the top-right of Edge and select “Settings.”
Step 2. Head to the “Default Browser” tab using the navigation bar.
Step 3. Select “Don’t Allow” from the drop-down box next to “Allow sites to be reloaded in Internet Explore mode (IE mode).”
The above is the detailed content of Five Common Office API Error Codes and What They Mean. For more information, please follow other related articles on the PHP Chinese website!