Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Retrieving List information from another sharepoint site

  Asked By: Bryson    Date: Aug 15    Category: Sharepoint    Views: 910

Here's a code snippet that will read in a list from some other
sharepoint server which allows you to access it through a standard

DataSet myDS = new DataSet();
ExternalLists.Lists listService = new ExternalLists.Lists();
listService.Credentials =
listService.Url = StartFrom + "/_vti_bin/Lists.asmx";
XmlDocument xmlDoc = new System.Xml.XmlDocument();

XmlNode ndQueryOptions = xmlDoc.CreateNode

= "<IncludeMandatoryColumns>TRUE</IncludeMandatoryColumns>";
XmlNode ndListItems = listService.GetListItems
XmlNodeReader reader = new XmlNodeReader(ndListItems);

myDS.ReadXml(reader, XmlReadMode.InferSchema);

This sets up a new dataset and makes a new instance of an
ExternalLists item. This is a web reference to the Lists within the
sharepoint object model (it doesn't reference any particular web
site, just the services)
It uses my credentials to access the foreign list.
"StartFrom" is the URL of where I am reading the list
I make an XML document and instruct the list service to retrieve all
lists that are found.
The XML reader translates the XML schema into a dataset.

The dataset can then be referenced using the XML schema names like
the following

FileName = myDS.Tables[1].Rows[i]["ows_LinkFilename"].ToString();
Modified = myDS.Tables[1].Rows[i]["ows_Modified"].ToString();
ModifiedBy = myDS.Tables[1].Rows[i]["ows_Editor"].ToString();




No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on Retrieving List information from another sharepoint site Or get search suggestion and latest updates.