我有幾個有關SharePoint(2010)最佳做法的常見問題。有關在SharePoint中進行開發時的最佳做法的一般問題
我目前正在實現一項功能,需要我從列表中獲取信息。我不太確定如何管理這些信息。我創建了一個幫助我管理這些信息的類(User.cs)。我在當前在特定列表中搜索值的類中有一個getter。我應該如何處理價值?我是否應該將它保留在成員中,並且僅在其主題發生變化時進行刷新,或者每次獲得時都應該從列表中刷新值?
private void doesUserHasActivities(){
using(SPSite site = new SPSite("http://vmsharepoint2010/")){
using(SPWeb web = site.openWeb("http://vmsharepoint2010/")){
SPList list = web.list["Users"];
SPListItem user;
/*Information values is refresh each time its accessed, is this bad ?*/
for(int i=0; i < list.items.length; i++){
user = list.item[i];
string accName = user["Acc_Name"];
if(accName == this.providedAccountname){//providedAccountname from a TextBox
//found the user i wanted into the list
//look if the list has data
bool hasActivities = user["Activities"] != null;
}
}
}
}
}
此外,有沒有其他的方法來訪問特定的數據,在這種情況下,活動列表,而無需通過每個行循環試圖給正確的用戶相匹配,然後在活動列表中查找值是多少?
我可以將行本身存儲爲元數據的成員嗎?如果添加了另一個用戶,我的參考是否仍然指向我想要的用戶列表的行?
您可能會在[sharepoint.se] – 2012-02-07 16:20:05