This code snippet gets URL of each SPListItem in the list. PAGETYPE sets which form should be picked (edit, display, new form).
using (SPSite site = new SPSite("http://spserver/"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["Orders"];
foreach (SPListItem item in list.Items)
{
Console.WriteLine(web.Url + "/" +list.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url + "?ID=" + item.ID);
}
}
}
No comments:
Post a Comment