0
我試圖創建一個可視的Web部件來顯示最新的5個公告列表項。Custom Share AnnouncementListItem Sharepoint 2010中的可視Web部件
我需要的公告列表項標題顯示爲鏈接和任何附件(僅圖片)來顯示正上方。我計劃每隔15-20分鐘刷新一次網絡部分,以便能夠顯示最新消息。
我不知道如何以及什麼最好的asp控件和頁面設計將顯示這些項目。
這裏是CAML查詢與我的代碼的其餘部分:
using (SPSite oSPsite = new SPSite("http://mySharePointWebApp:Port#/"))
{
using (SPWeb oSPWeb = oSPsite.OpenWeb())
{
oSPWeb.AllowUnsafeUpdates = true;
// Fetch the List
SPList list = oSPWeb.Lists["Announcements"];
SPQuery spQuery = new SPQuery();
//spQuery.Query = "<Where> <Eq> <FieldRef Name='Title' /> <Value Type='Text'></Value> </Eq> </Where>";
spQuery.Query = "";
spQuery.RowLimit = 5;
// Show item in text box
SPListItemCollection oListCollection = list.GetItems(spQuery);
foreach (ListItem oListItem in oListCollection)
{
// **What should I go with here?**
}
}
}
嗨肯感謝您的意見。我真的是新的編程,但想知道你是否可以擴大一點,我將如何實際綁定LINQ或CAML查詢到列表框控件。 – user1266515 2012-03-16 13:02:37