Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Need help in changing code from SP object model to client object model

$
0
0

Hi

Need help in transforming SP object model to client object model:

I am trying to submit infopath form data to the form library programatically which works in my dev server. The same code I would like to have in client object model so that I can submit the infopathform data to my test server from DEV's VS 2010 console application. 

Here is the code which I am using to submit infopath data to form library programatically.

                   infoPathFormData = ms.GetBuffer();
                    ms.Close();

                    string rFormSite = @"http://MyCompany.com/MySite/InfopathLibrary";//TEST
                    using (SPSite site = new SPSite(rFormSite))
                    {
                        using (SPWeb web = site.OpenWeb())
                        {
                            web.AllowUnsafeUpdates = true;
                            SPList SpList = web.Lists["InfopathLibrary"];
                            SPFile file;
                            SPFolder mylibrary = web.Folders[SpList.Title];
                          
                            file = mylibrary.Files.Add(String.Concat(ds.Tables[0].Rows[i]["Name"].ToString(), ".xml"), infoPathFormData);

                            file.Properties["Project Name"] = ds.Tables[0].Rows[i]["Name"].ToString();
                            file.Properties["UID"] = ds.Tables[0].Rows[i]["UID"].ToString();
                            file.Properties["Status"] = ds.Tables[0].Rows[i]["Status"].ToString();
                            file.Properties["Investment"] = ds.Tables[0].Rows[i]["Investment"].ToString();
                            file.Update();
                           
                        }
                    }

Please suggest.



Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>