Archive

Archive for February, 2011

SharePoint 2010 – Cannot complete this action. Please Try again.

February 11, 2011 Leave a comment

Recently while debugging a web part in SharePoint 2010, I received this error message.  I had never seen it before but after doing some searching, I found that apparently this happens quite a lot in SharePoint.

First thing I tried was to open the page in ?contents=1 mode and found the following:

Once the erroneous web parts were removed, I redeployed my solution and added my new webpart onto the page, but alas, still getting the same error.

So, I decided to take a closer look at my code, more specifically, the list I was deploying, and the code used to query it.  After more than a few hours of staring at the answer (and even almost giving up and putting a post for help on stackoverflow.com) I noticed this:

<Where>
  <FieldRef Name="Source" />
  <Value Type="Text">http://dev01:80/Pages/default.aspx</Value>
</Where>

Damn! Poor CAML syntax – the bane of my existance.  After changing the CAML so it was formatted properly:

<Where>
  <Eq>
    <FieldRef Name="Source" />
    <Value Type="Text">http://dev01:80/Pages/default.aspx</Value>
  </Eq>
</Where>

Everything started working as it should.  Why Microsoft decided to stick us with this crappy query language then provide us with no means of validating it and give us completely ambiguous errors and COM errors on top of it all (or below it all depending on how you look at it) just makes me question why I ever decided to use Microsoft products to begin with.

Advertisements
Categories: Uncategorized Tags: ,