locked
Error InfoPath has encountered an error. The operation failed. RRS feed

  • Question

  • Sign in to voteI explain my problem scenario by examples and need your kind help in this regards. Thanks in advance.

    I am using InfoPath Designer 2013 along with Microsoft Visual Studio Professional 2012 in SharePoint 2013

    I am trying to migrate a InfoPath form code from SharePoint 2010 to SharePoint 2013. In SharePoint 2010 we were using InfoPath designer 2007.

    But below error is generic error I get in my development environment. I will explain it by creating an empty code project from start.

    I am working with InfoPath solution with Full trust with managed code including code from SharePoint object model on Microsoft Windows Server 2012 R2 Standard server machine.

    I create a new clean InfoPath solution and click on Code Editor and it opens then code by "Code Editor" button.

    I build the solution and it works fine.

    Next stage is to add SharePoint reference dll from C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.dll and build the solution and it builds fine wihout any error.

    The I just add a small piece of SharePoint code SPContext.Current.Web.Url

    and build it but then I get error and warning as shown below.

     --------------------------------------------------------------------------------------------------------

    Warning 2 The primary reference "Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets 1605 5 

     --------------------------------------------------------------------------------------------------------

    Error: Error 1 The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) C:\Users\myusername\AppData\Local\Temp\5\Vsta\InfoPath\VstaJPquu1x5GkOwBi01lDqNsA\VstahqHPCqWNWUi91YBMd0kcGg\FormCode.cs 5 17 

    --------------------------------------------------------------------------------------------------------

    Then I believe above error may be because of wrong Target Framework in Project settings.

    I go into Project settings and it is Target Framwork = .NET Framwork 4 mentioned there

    Then I modified "Target Framwork" to ".NET Framwork 4.5". Build it and it build the solution successfully without any warning/error.

    But then when i try to publish it I get "Error InfoPath has encountered an error. The operation failed." in a dialogue message.

    Now the InfoPath template is no more save-able. Every time I try to save it it gives me error. "InfoPath cannot save the following form. File cannot be accessed"

    Then I closed InfoPath designer and re-opened it then again clicked on the Code Editor and it opens then code Project. I checked Target Framwork that was again setted back to .NET Framwork 4  and if i try to build code then it fails and giving med same error and warning as mentioned above

    Anyone here has experienced such problem?

    Thanks in advance


    fai_developer







    Wednesday, December 9, 2020 10:27 AM

Answers

All replies