Hello Everyone,
In a followin post we will see how to read Enhanced Rich Text value from SharePoint List/Library.
If reading this Column Value in regular way you will get the output in the combination of some html code like <div>.. </div>
To get the Rich Text Value in plain we need to write code as below.
In a followin post we will see how to read Enhanced Rich Text value from SharePoint List/Library.
If reading this Column Value in regular way you will get the output in the combination of some html code like <div>.. </div>
public void ReadMultiLines()
{ try { using (SPSite oSite = new SPSite("http://localhost")) { using (SPWeb oWeb = oSite.OpenWeb()) { SPList list = oWeb.Lists.TryGetList("SampleList"); if (list != null) { SPListItemCollection _coll = list.GetItems(); foreach (SPListItem item in _coll) { Console.WriteLine(item["Title"].ToString()); Console.WriteLine(item["Column1"].ToString()); } } } } } catch (Exception ex) { } }Out put will be looks as follow,
To get the Rich Text Value in plain we need to write code as below.
if (!string.IsNullOrEmpty(Convert.ToString(item["Column1"]))) { SPFieldMultiLineText plainBody = item.Fields.GetField("Column1") as SPFieldMultiLineText; if (plainBody != null) { string body = plainBody.GetFieldValueAsText(item["Column1"]); Console.WriteLine(body); } }
Now,We can see the output as below,
Related Post
SharePoint 2013
- List view render using JSLink with Fabric UI
- Delete Quick Links using Powershell
- delete/Add Top Navigation Links using Powershell
- Get CheckedOut Files from SharePoint 2013 and MOSS2007
- PowerShell::Get Content Database Size in SharePoint
- PowerShell :: Delete All List Items
- Powershell :: Apply Master Page to all sub sites under site collection
- Internet Explorer cannot display this feed - while accessing REST URL in SharePoint
- SharePoint Installation: The tool was unable to install application server role web server (IIS) role SharePoint 2013.
- Basics: Difference between Synchronous Events and Asynchronous Events in SharePoint
- Remove-SPSite 0x80070003 - Forcely delete Site Collection that cannot be deleted
- This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft SharePoint 2010 Products.
- Restore-SPSite: The operation that you are attempting to perform cannot be completed successfully.
- Migrate Multiple site(sub sites) using MetaLogix and change the Template in Target
- Issue:The date file "C:\ProgramData\Metalogix\EnvironmentSettings.xml" contains invalid data.Values in that file reset to defaults
- Get List Field Type using ECMA Script in SP Hosted Apps
- SharePoint Interview Questions and Answers..
- Issues:SharePoint Foundation 2013 Prerequisites installation(off line) on Windows Server2012 R2
- Get Choice Field Type Values using ECMA Script
- Something Went wrong error message while deploying App in SharePoint 2013
- The Server was unable to save the form at this time. Please try again.
- Get the Items inside the Folder in document Library in SharePoint 2013 using REST API
- SharePoint Client Browser for SharePoint Online and SharePoint On-Premises
- What is Managed meta data service in SharePoint 2010, 2013 and How to Configure it?
- Deprecated features in SharePoint 2013
SharePoint 2010
- List view render using JSLink with Fabric UI
- Delete Quick Links using Powershell
- delete/Add Top Navigation Links using Powershell
- PowerShell::Get Content Database Size in SharePoint
- PowerShell :: Delete All List Items
- Basics: Difference between Synchronous Events and Asynchronous Events in SharePoint
- Remove-SPSite 0x80070003 - Forcely delete Site Collection that cannot be deleted
- This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft SharePoint 2010 Products.
- Restore-SPSite: The operation that you are attempting to perform cannot be completed successfully.
- Get List Field Type using ECMA Script in SP Hosted Apps
- SharePoint Interview Questions and Answers..
- What are Event Receivers and How to Create Sample event Receivers and attach to List/ Doc Library ?
- Export SharePoint Search Crawl log to CSV File.
- Create Content Type using ECMA Script
- Get List Content Types using ECMA Script
- SharePoint Modal Dailoge to Open Page
- SPDataSource in SharePoint.
- Capacity planning and Sizing in SharePoint 2010
- Enable 'Save site as Template' in Publishing Sites by using SharePoint Designer
- What is Web part life Cycle in SharePoint 2013 and SharePoint 2010
- How to Hide Controls in SharePoint New Form Based on User using ECMA Script.
- What is the Content Type for Custom List in SharePoint 2013, SharePoint 2010
- What is calculated column in SharePoint 2013 ,2010
- Create Meetings by using Exchange Server API
0 comments:
Post a Comment