Get items from sharepoint list

private ArrayList GetServerList()
{
ArrayList sNames = new ArrayList();
Guid id = new Guid(“46089E30-FCD1-45C9-9437-454754C5058D”);
SPSite SiteCol = new SPSite(id);
SPList splist = SiteCol.AllWebs[“”].Lists[“Servers”];

SPQuery oQuery = new SPQuery();
oQuery.Query = “” +
“True”;
SPListItemCollection listItems = splist.GetItems(oQuery);

foreach (SPListItem listitem in listItems)
{
sNames.Add(listitem[“ServerName”].ToString());
//string test = listitem[“ServerName”].ToString();
}
return sNames;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: