Insert picture text into a Sharepoint Listitem

Asked

Viewed 240 times

2

I create items in Sharepoint, with a WPF/C#app, as in the example:

using System;
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointServices.Samples
{
    class CreateListItem
    {
        static void Main()
        {   
            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements");

            ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
            ListItem oListItem = oList.AddItem(itemCreateInfo);
            oListItem["Title"] = "My New Item!";
            oListItem["Body"] = "Hello World!";

            oListItem.Update();

            clientContext.ExecuteQuery(); 
        }
    }
}

The point is that in the "Body" column, I would have to insert a content coming from a Richtextbox, where it is possible to insert text with images.

I couldn’t find a way to insert the text and images, added as in a word document, into that column. Getting the RTB content with textRange results in converting the image to hexadecimal, which does not suit me.

I know that it may be necessary to save the images in a directory inside Sharepoint and refer them to the text, as an index or something, but I did not find documentation and I have no idea how to do.

  • 1

    Your problem is in defining Listitem as Richtext or reading and converting the word document?

  • 1

    My problem is in converting the contents of a Richtextbox, which is in my application, to the column of Listitem of SP. If it were only text, it would be quiet, as in the example. But since Richtextbox in my application can contain images next to the text, I don’t know how to enter this data.

  • 2

    What type of text does Sharepoint accept ? could send html ?

  • It accepts html, however, if sending an html I would have to identify the images in the middle of the text, upload them to a folder within Sharepoint, so it is possible to refer them to the html content

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.