This SharePoint query error kept me busy for a while because the error message is very generic and useless, so I hope my experience can help someone in the future. When I ran my ASP.NET application to query a specific resource item from a SharePoint list the other day, I got this error message:
Cannot complete this action.
Please try again.
You can see that this error is very generic and it didn’t provide much information about what went wrong, and the stack trace of the error only shows which line caused the problem.
Below is a screenshot of my source code.
I also stepped into my source code many times but still could not figure out what the root cause of this error, until hours later I suddenly noticed there is a typo in my query string as shown in the following screenshot:
As shown above, I missed a “<” in the close tag </Where> for my CamlQuery and the malformatted query caused ExecuteQuery() to fail, but I am surprised it does not give much helpful information of the exception caused by a malformatted query.
Anyway, after I fixed the query, the error went away. I hope my experience can save you some time if you happen to encounter the same exception error in your .NET application.