Quantcast
Channel: SharePoint 2010 - Setup, Upgrade, Administration and Operations forum
Viewing all articles
Browse latest Browse all 13778

Retrieve list items from different server

$
0
0

Hi Folks,

i have 2 servers one is on SharePoint 2010 and other is on SharePoint 2013. i need to retrieve list data from 2013 and display in 2010 server farm using webpart. both are separate environment but in a same domain. 

could anyone tell me how to do that. i have tried list.asmx but i am facing authentication issue it gives me this error.

The request failed with HTTP status 401: Unauthorized.

it gives me error on this line.

    XmlNode listItems = client.GetListItems("List", null, null, viewFields, null, null, null);

and this is my code in WP

ServiseRef.Lists client = new ServiseRef.Lists();
                   client.Credentials = new NetworkCredential("testdomain\\testuser", "12345");
                   System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
                   System.Xml.XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
                   viewFields.InnerXml = "<FieldRef Name=\"Title\" />";

                   XmlNode listItems = client.GetListItems("List", null, null, viewFields, null, null, null);
                   foreach (XmlNode node in listItems)
                       if (node.Name == "rs:data")
                           for (int f = 0; f < node.ChildNodes.Count; f++)
                           {
                               if (node.ChildNodes[f].Name == "z:row")
                               {
                                   string title = node.ChildNodes[f].Attributes["ows_Title"].Value;

                               }
                           }


BestRegards|SharePoint Techies


Viewing all articles
Browse latest Browse all 13778

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>