Skip Ribbon Commands
Skip to main content

Vardhaman Deshpande | zevenseas | SharePoint Blog

:

Vardhaman Deshpande | zevenseas | SharePoint Blog > Posts > Get HTML from page using the SharePoint Client Object Model
April 27
Get HTML from page using the SharePoint Client Object Model

​Here is how to get the RAW HTML of a Web Page on your SharePoint Site using the Client Object Model:

Just substitute your Site Collection name instead of "sitecollection" and your page path along with the Relative Server URL instead of /Sites/Vard/SitePages/Home.aspx


ClientContext clientcontext = new ClientContext(sitecollection);
var page = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientcontext, "/Sites/Vard/SitePages/Home.aspx");
StreamReader reader = new StreamReader(page.Stream);
string pageHTML = reader.ReadToEnd();
The string variable pageHTML will now have the raw html of the Home.aspx page.

Have Fun!


Comments

android phones

Article was written well ,thanks for sharing.I also like to share a nice product
<a href=http://www.ahappydeal.com/wholesale-ONDA-tablet-pc.html>ONDA tablet</a>I hope you will like it
 on 4/2/2013 12:41 AM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


ReCaptcha

 

Attachments

 

 Related Posts

 
Firing events inside a modal dialog in SharePoint 2010
Creating publishing pages with powershell in SharePoint2010
Released; Office365 Beta Deployment guide for Enterprises
SharePoint webservices overview
SharePoint Server 2010 performance and capacity test results and recommendations
Export List Data to Excel in SharePoint
Try catch blocks in JSOM for server error in SharePoint 2010
Office365 beta and the SharePoint 2010 Client Object Model
Add Web Part to Page using SharePoint Client Object Model:File not Found error.
Office 365 Sandboxed Solutions:Exceeded the daily resource usage quota.
Bing Maps Silverlight Control in Office 365
JavaScript "L_Menu_BaseUrl" variable for SharePoint
SPSiteDataQuery in Sandboxed solution with multivalued metadata column
Feature activation with Client object model (ECMA script) and sandboxed solution
Overcoming the sandbox limitation…Client object model (ECMA script) volunteers adding web parts on page
Sorting Filtering client side .. Rich user experience with JQUERY and ECMA script client object model
Restricting web part adding on page for specific zones with wonderful SharePoint JavaScripting
ECMA script client object model and SQM collection in SP2010
Asset Picker with dynamically created HTML with JQuery in Sandbox solution
Conflicts of a C# developer and PowerShell
Check if page is in Edit Mode on Client Side in SharePoint 2010
Getting Site usage info in SP2010 using Client Object model
Configuring Failover Database in SharePoint 2010
SharePoint 2010 Image library with size options
Missing Site Pages in Personal Site
SharePoint 2010 Search capabilities
 

 Statistics

 
Views: 2423
Comments: 0
Tags:Client Object Model, SharePoint 2010
Published:783 Days Ago