locked
can we update Infopath Form column through SharePoint 2007 Timer Job? RRS feed

  • Question

  • Hi All,

    I have one form library for my infopath form. My Infopath 2007 form is code based, full trust and through Manage templates we have uploaded this from central administration and activated to particular site.

    Once user by filling all the details when he click on submit button we are simply updating all form column to library(peoperty promotion).

    Once user submits the form, an automatic email goes to approver, if he approve/deny status column will be changing to Approved/Denied.

    We have one timer job in MOSS 2007 which will check automatically if approver doesn't approve with in 3days, we need to change Status automatically to "Non responsive approver".

    But my problem is eventhogh code is executed in Timer Job, Timer Job is not updating "Status" column in form library. As we have verified content type settings etc, but no luck.

    Could you please suggest on how to update form library column from Timer Job?


    Thanks & Regards, Neerubee

    Monday, July 9, 2012 10:05 AM

Answers

  • Hi,

    This option is only available when you promote your metadata from the publish screen (and not from option of the form).

    You can see this option on my french InfoPath 2010 (the screen is the same in 2007):

    Hope this helps.


    Visit my blog : http://rmatayron.blogspot.com/

    Wednesday, July 11, 2012 12:12 PM

All replies

  • Hi,

    If the column status is a field of you InfoPath form, you need to promote this field by the publish screen. Huere you tell InfoPath that this field can be updatable.

    Hope this helps.


    Visit my blog : http://rmatayron.blogspot.com/

    Monday, July 9, 2012 7:33 PM
  • Hi,

    At last i found solution for this. By using XMlDocument and get element by tag name, i am able to set the FormStatus column value from Timer Job. We can't directly update the 'FormStatus' column in Form library through SharePoint object model.

    Below is the sample code for this.

    example:

    XmlDocument xml = new XmlDocument();
    using (Stream s = itmForm.File.OpenBinaryStream())
    {
        xml.Load(s);
      }

        XmlNodeList nodes = xml.GetElementsByTagName("my:FormStatus");
         foreach (XmlNode node in nodes)
          {

              node.InnerText = "Denied";
           }
           //Get binary data for new XML     

       byte[] xmlData = System.Text.Encoding.UTF8.GetBytes(xml.OuterXml);
       using (MemoryStream ms = new MemoryStream(xmlData))
        {
            //Write data to SharePoint XML file      
             itmForm.File.SaveBinary(ms);
         }


    Thanks & Regards, Neerubee

    Tuesday, July 10, 2012 5:43 AM
  • Hi,

    Your solution works fine but she open all the form to load it into an XMLDocument.

    There is an easier solution by promoting the property with modifiable option as I told you on the previous post.

    If you do this, you only have to do:

    itemForm["FormStatus"] = "Denied";
    
    itemForm.SystemUpdate(false);
    

    This could be faster than open your form in the XMLDocument.


    Visit my blog : http://rmatayron.blogspot.com/

    Wednesday, July 11, 2012 5:34 AM
  • Hi, We have already promoted FormStatus column while publishing. We did'nt get option to edit for field can be editable. Are you using WSS 3.0 environment. Mine is MOSS 2007 + Infopath 2007 code based browser enabled form with Full trust. We are not getting this option for making editable.

    Thanks & Regards, Neerubee

    Wednesday, July 11, 2012 6:02 AM
  • Hi,

    This option is only available when you promote your metadata from the publish screen (and not from option of the form).

    You can see this option on my french InfoPath 2010 (the screen is the same in 2007):

    Hope this helps.


    Visit my blog : http://rmatayron.blogspot.com/

    Wednesday, July 11, 2012 12:12 PM