img.png

Whether you are an experienced SharePoint developer, or just getting started, you have most likely suffered at least one of these frustrating mishaps and lost an hour or two before figuring out the cause of the problem. Luckily, on first encounter, what seems to be a tricky error is often easily solved.

Let’s start simple.

1.) Updating The Wrong Web Application

You are changing something, the code works, no exception is triggered, but you go to the SharePoint site and nothing has changed. Go back and check the web app you have selected, you might be updating the wrong one. Sounds simple, but it is easily done.

2.) Wrong Field Name

Your CAML query is fine, but you get an exception saying that the list's fields are wrong. Go to the list definition and to the field definition, there in the URL you have the field internal name as SharePoint expects it… and it’s wrong. A tip is to have them as constants somewhere, spell them out properly and refer back to them for the duration of your project.

3.) Wrong List

The item you are trying to create doesn't appear in the list, or it complains about the field names which, as far as you can see, are correct. Check that you are connected to the right list. Again – simple, but easy to do. You could also have constants for the list names to avoid this in the future.

4.) Wrong DLL

You change something in your code, and still you get an error. Depending on what you are doing, you might need to deploy the DLL to the GAC or the BIN folder, the right DLL, and then reset it to the right service – sometimes it is not the IIS. Try changing a string (or something very obvious to spot) to make sure that the code you are running is the code you want to run.

5.) Web Services Won't Connect To The Server

You need to create a clientaccesspolicy.xml file or a crossdomain.xml and put it in the web application's inetpub folder. So simple and yet so annoying.

And a bonus tip.

6.) Changes Do Not Appear In SharePoint

Right list, right web, right fields, right everything and yet nothing happens when you change the object. You have most likely forgotten to update it. The same goes for a lot of different items in SharePoint, not only list items. If in doubt, always try to add an update after modifying. Beware, the updates are usually slow and should be kept to a minimum.

This post originally appeared on www.codegrimoire.com

If you'd like to discuss this article or any of these points specifically, please enter your details below, and we'll get back to you!

hbspt.forms.create({ portalId: '556135', formId: '0ff92a7a-8e2e-45ad-a8ae-e94f49b7b65b' });