Skip to main content

Hello everyone. I've the problem (like always 😉 ). My task is: I want to get links of documents from sharepoint document library. For this I'm using smartobjects and Get List function. This way I get xml file with link to documents. But now I don't know how to parse this xml. When I paste this into mail I get inline string. I would lik to export this somewhere or write this to e-mail with html content. For example:

 

  • http://somedocument
  • http://somedocument2

 Could someone help me with my problem? I'd be very gratefull.

 Thanks 

Y

Could you please eloborate more. You have an xml file and want to parse it?

Do you have a XML file or K2 XML field?


If you have K2 XML field (and you surely can have it if you generate Content Field with SharePoint Lists event) than you may use simple looping through nodes like:


XmlDocument

XMLDoc = new XmlDocument();


XMLDoc.LoadXml(K2.ProcessInstance.XmlFields[

"Your K2 XML Field"].Value);


XmlNode node = XMLDoc.SelectSingleNode("XPath to the node that is parent to your repeating nodes, for ex.: Items or Document/Items");


if (node.ChildNodes.Count>0) // if parent node has repeating (or single of course) node(s)


{


myConn.Open();


int i =0;


for (i=0; i<=node.ChildNodes.Count-1;i++)


{


string str;


str = node.ChildNodes.ChildNodes[0].InnerText; // Gets the 1st item in your repeating nodes


}


}


Reply