I need to extract InfoPath form fields in C# using Client Side Object Model(CSOM) and convert it into XML file.
The code which I tried to get FormLibrary fields is
// Starting with ClientContext, the constructor requires a URL to the // server running SharePoint. ClientContext context = new ClientContext("http://SiteURL/"); // Assume the web has a list named "Announcements". List announcementsList = context.Web.Lists.GetByTitle("MyFormLibrary"); // This creates a CamlQuery that has a RowLimit of 100, and also specifies Scope="RecursiveAll" // so that it grabs all list items, regardless of the folder they are in. CamlQuery query = CamlQuery.CreateAllItemsQuery(100); ListItemCollection items = announcementsList.GetItems(query); // Retrieve all items in the ListItemCollection from List.GetItems(Query). context.Load(items); context.ExecuteQuery(); foreach (ListItem listItem in items) { // We have all the list item data. For example, Title. Console.WriteLine( listItem["Title"]); }
I am getting Title
field as name of xml file but when I debug it, giving me error in StackTrace as
at Microsoft.SharePoint.Client.ClientObject.CheckUninitializedProperty(String propName) at Microsoft.SharePoint.Client.File.get_Name()
can anyone please help me !!! Any help is appreciated.