locked
Rich Text Box formatting is not saved to SharePoint Rich Text Field RRS feed

  • Question

  • I have a windows form application (.net 3.5) that has a simple Rich Text Box control with a hyperlink and some text. I am able to add the item to a sharepoint list using the Lists.asmx web service but the formatting of the Rich Text Box control on the WinForm application is not being saved to the SharePoint Rich Text field.

            private void AddItemToWSS()
            {
                KB.Lists kbList = new KB.Lists();
                kbList.Url = ListServiceUrl;
                kbList.Credentials = System.Net.CredentialCache.DefaultCredentials;
    
                XmlDocument doc = new XmlDocument();
                XmlElement batch = doc.CreateElement("Batch");
    
                batch.SetAttribute("OnError", "Continue");
                batch.SetAttribute("PreCalc", "TRUE");
                batch.SetAttribute("ListVersion", "1");
                batch.SetAttribute("ViewName", ListView);
    
                //CREATE NEW ITEM
                batch.InnerXml = "<Method ID='1' Cmd='New'>" +
                    "<Field Name='ID'>New</Field>" +
                    "<Field Name='Title'>" + tbTest.Text + "</Field>" +
                    "<Field Name='Body'>" + rtbBody.Text + "</Field>" +
                    "</Method>";
    
                try
                {
                    kbList.UpdateListItems(ListName, batch);
                }
                catch (Exception ex)
                {
                    rtbBody.Text += ex.ToString();
                }
            }
    Is there a formatting option i need to set in order for the WinForm Rich Text formatting to be saved to a SharePoint Rich Text field?

    Thanks for your help.
    Rick
    http://www.sharepointdynamics.net

    .gonad
    Thursday, January 21, 2010 4:01 PM