Sharepoint 内置了几种列表类型:

  


public enum SPBaseType
{
    UnspecifiedBaseType 
= -1,
    GenericList 
= 0,
    DocumentLibrary 
= 1,
    Unused 
= 2,
    DiscussionBoard 
= 3,
    Survey 
= 4,
    Issue 
= 5,
}

 

 

 /// <summary>
        
/// 新建列表
        
/// </summary>
        
/// <param name="sender"></param>
        
/// <param name="e"></param>
        protected void btn_Click(object sender, EventArgs e)
        {
            
using (SPSite site = new SPSite(requestUrl))
            {
                
using (SPWeb web = site.OpenWeb())
                {
                    SPList list 
= null;
                    
string listName = txtListName.Text.Trim();
                    
// Check whether the list already exists
                    try
                    {
                        list 
= web.Lists[listName];
                    }
                    
catch (ArgumentException)
                    {
                    }
                    
if (list == null)
                    {
                        Guid listId 
= web.Lists.Add(listName, "All our books",SPListTemplateType.GenericList);
                        list 
= web.Lists[listId];
                        list.OnQuickLaunch 
= true;
                        list.Update();
                    }
                }
            }
        }

相关文章:

  • 2021-11-22
  • 2022-12-23
  • 2022-02-02
  • 2021-12-14
  • 2022-12-23
  • 2022-02-22
  • 2021-05-27
猜你喜欢
  • 2022-01-13
  • 2022-12-23
  • 2021-09-13
  • 2021-12-15
  • 2021-06-13
  • 2021-09-04
相关资源
相似解决方案