Click here to Skip to main content
16,016,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Techies

I brought the sharepoint document library into asp.net application, From that i want to show the version history of a particular file
If i select the particular file means i get the version history using versions webservice, I got the version history as a XML format. now i want it to bind in Grid.

The XML Is below

<list id="{918044DD-4034-4804-862D-91DA49D93299}" xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
<versioning enabled="1" xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
<settings url="http://admin:10085/_layouts/LstSetng.aspx?List={918044DD-4034-4804-862D-91DA49D93299}" xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
<result version="@2.2" url="http://admin:10085/DocumentLibrary/New Text Document (2).txt" created="11/10/2011 3:31 PM" createdBy="ADMIN\administrator" size="25" comments="xcvbxc" xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
<result version="1.0" url="http://admin:10085/_vti_history/512/DocumentLibrary/New Text Document (2).txt" created="11/9/2011 7:54 PM" createdBy="ADMIN\administrator" size="25" comments="" xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
<result version="2.1" url="http://admin:10085/_vti_history/1025/DocumentLibrary/New Text Document (2).txt" created="11/10/2011 3:31 PM" createdBy="ADMIN\administrator" size="25" comments="" xmlns="http://schemas.microsoft.com/sharepoint/soap/" />


Please help me to sort out this problem....
Posted
Updated 11-Nov-11 1:56am
v3

You have to Convert the Xml data to DataTable first and bind that DataTable object to GrideView;
C#
DataTable dt = new DataTable();
dt.ReadXml(@"filepath.xml");
GridView1.DataSource = dt;
GridView1.DataBind();
 
Share this answer
 
Comments
chitmm 17-Sep-12 21:38pm    
DataTable does not support schema inference from Xml!!!
when u right click the gridview control in the asp.net page it ll ask for the source u can also choose the xml file form there...jus try it
 
Share this answer
 
the solution is below

Versions objVersions = new Versions();
objVersions.Url = ConfigurationManager.AppSettings["SharepointVersionService"];
objVersions.Credentials = CreateCredentials();
XmlNode Result = objVersions.GetVersions(FileName);
if ((Result != null) & Result.InnerXml.Length > 0)
{
XmlTextReader objXmlTextReader = new XmlTextReader(Result.OuterXml, XmlNodeType.Element, null);
DataSet objDataSet = new DataSet();
objDataSet.ReadXml(objXmlTextReader);
Gridhistory.DataSource = objDataSet.Tables[3].DefaultView;
Gridhistory.DataBind();

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900