If you're creating the Custom Web Part and using C#.NET, you should know SPListItem.
When you want to show the information of each item from the Document Library, we normally use the foreach-loop. I know some of the following variables from senior colleague. I think they are necessary things to know.
SPWeb web = SPContext.Current.Web;
SPList List = web.Lists[Doc_Lib_Name];
SPListItemCollection items = List.Items;
foreach (SPListItem item in items)
{
// Display File Name.
writer.Write(item.DisplayName);
// Display Document ID.
writer.Write(item.ID);
// Display Metadata Column.
writer.Write(item["Column_Name"].ToString());
// Write Metadata Column.
item["Column_Name"] = "NaTT.biz";
item.Update();
// Compare String with Metadata Column.
String.Compare( (string) item["Column_Name"],"NaTT.biz");
// Display url of item.
writer.Write(web.Url + "/" + item.Url);
}
No comments:
Post a Comment