{"id":3071,"date":"2010-05-26T14:40:13","date_gmt":"2010-05-26T14:40:13","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/sharepoint-and-comexception-0x80004005-cannot-complete-this-action\/"},"modified":"2016-07-28T10:50:01","modified_gmt":"2016-07-28T10:50:01","slug":"sharepoint-and-comexception-0x80004005-cannot-complete-this-action","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/sharepoint-and-comexception-0x80004005-cannot-complete-this-action\/","title":{"rendered":"SharePoint and COMException (0x80004005): Cannot complete this action"},"content":{"rendered":"<p>I ran into a small issue today working on a deployment.&#160; We were moving a custom ASP.NET control from my development environment into a SharePoint layout page on a staging environment .&#160; I was expecting some minor issues to arise since I had developed the control in an ASP.NET website project, but after getting everything moved over we got an obscure COMException error the that looked like this:<\/p>\n<hr \/>\n<p>Cannot complete this action. <\/p>\n<p>Please try again.    <br \/>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <\/p>\n<p>Exception Details: System.Runtime.InteropServices.COMException: Cannot complete this action. <\/p>\n<p>[COMException (0x80004005): Cannot complete this action. <\/p>\n<p>.Lengthy stack trace goes here.<\/p>\n<hr \/>\n<p>Everything in the custom control was built using managed code, so we weren&#8217;t sure why a COMException would suddenly appear. The control made use of an ITemplate to define its UI, so there was a lot of markup and binding code inside the template. As such, we started taking chunks of the template out of the layout page and eventually the error went away.&#160; It was being caused by a section of code where we were calling a custom utility method inside some binding code:<\/p>\n<p>&lt;%# WebUtility.FormatDecimal(.) %&gt;<\/p>\n<p><strong>Solution:<\/strong><\/p>\n<p>It turns out that we were missing an Assembly and Import directive at the top of the page to let the page know where to find this method.&#160; After adding these to the page, the error went away and everything worked great.&#160; So a <strong>COMException (0x80004005) Cannot complete this action<\/strong> error is just SharePoint&#8217;s friendly way of letting you know you&#8217;re missing an assembly or imports reference.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I ran into a small issue today working on a deployment.&#160; We were moving a custom ASP.NET control from my development environment into a SharePoint layout page on a staging environment .&#160; I was expecting some minor issues to arise since I had developed the control in an ASP.NET website project, but after getting everything&#8230;&hellip;<\/p>\n","protected":false},"author":46738,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[],"coauthors":[],"class_list":["post-3071","post","type-post","status-publish","format-standard","hentry","category-blogs"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3071","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/46738"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=3071"}],"version-history":[{"count":2,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3071\/revisions"}],"predecessor-version":[{"id":41898,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3071\/revisions\/41898"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=3071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=3071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=3071"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=3071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}