Infopath updating form library column after submit error - InfoPath Dev
in

InfoPath Dev

Infopath updating form library column after submit error

Last post 02-14-2009 06:12 PM by SteveH. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 02-14-2009 06:12 PM

    • SteveH
    • Not Ranked
    • Joined on 02-14-2009
    • Posts 1

    Infopath updating form library column after submit error

    Hi, wonder if someone can help me with this error:

    I am trying to submit a form and then after the submit to update a column using the code below, however I am getting the following error:

    "The OnSubmitRequest event handler did not work" and in the details was this error "Could not load file or assembly 'Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified." but when I run it on the SP server it runs fine ... only when I run it from outside the server I get the above mentioned errors.

    Any ideas? suggestions?

    Thanks

    Steve

                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    SPWeb site = new SPSite("http://serverurl/").OpenWeb();
                    SPFolder folder = site.GetFolder("Multi Form Approval");
                    SPFileCollection files = folder.Files;

                    try
                    {
                        foreach (SPFile file in files)
                        {
                            if (file.Item.Name == fileName.Trim() + ".xml")
                            {
                                file.Item["Manager Name"] = managerName;
                                site.AllowUnsafeUpdates = true;
                                file.Item.Update();
                                site.AllowUnsafeUpdates = false;
                            }
                        }
                    }
                    catch(Exception ex)
                    {
                        Console.WriteLine(ex.Message);               
                    }
                });
                // If the submit operation is successful, set
                e.CancelableArgs.Cancel = false;
                // Write your code here.
                }

     

     

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.