开发者

Create a web part which takes input from a tasklist

开发者 https://www.devze.com 2022-12-10 00:29 出处:网络
I\'开发者_如何学运维m in need of creation of a web part which takes input from a task list and changes the color of the tasklist based on the data in the task list. Can anyone help me with this proble

I'开发者_如何学运维m in need of creation of a web part which takes input from a task list and changes the color of the tasklist based on the data in the task list. Can anyone help me with this problem? I can write code in visual studio 2005. My question is how do I take input data from the list?


Sample code here. This should get you started. (source)

using Microsoft.SharePoint;  

class SPTest {  
 public void ReadList() {  
  // Use using to make sure resources are released properly  
  using(SPSite oSite = new SPSite(pathToSite)) {  
    using(SPWeb oWeb = oSite.AllWebs[nameOfWeb]) {   
      // Alternately you can use oSite.RootWeb if you want to access the main site  

      SPList oList = oWeb.Lists[listName];  // The display name, ie. "Calendar"  

      foreach(SPListItem oItem in oList.Items) {  
        // Access each item in the list...  
        DateTime startTime = (DateTime)oItem["Start Time"];  
        // etc....  
      }  

    }  
  }  

 }  
}
0

精彩评论

暂无评论...
验证码 换一张
取 消