List template文件放在Site Actions – Galleries  - List templates中。

1.上传.stp文件

 

As SPSite)
, Application.StartupPath)
Try
Then
, System.IO.SearchOption.TopDirectoryOnly)
TryCast(_site.GetCatalog(SPListTemplateType.ListTemplateCatalog), SPDocumentLibrary)
Then
In templates
   9:  
New System.IO.FileInfo(template)
New SPQuery()
, fileInfo.Name)
As SPListItemCollection = listTemplates.GetItems(query)
  14:  
Integer(existingTemplates.Count - 1) {}
To existingTemplates.Count - 1
  17:                         Ids(i) = existingTemplates(i).ID
Next
To Ids.Length - 1
  20:                         listTemplates.Items.DeleteItemById(Ids(j))
Next
  22:  
Byte() = System.IO.File.ReadAllBytes(template)
  24:                     listTemplates.RootFolder.Files.Add(fileInfo.Name, stp)
Next
If
If
As Exception
  29:  
Try
End Sub

2.得到ListTemplate Collection

 

 

 

As SPListTemplateCollection = _site.GetCustomListTemplates(_web)
   2:  ListBox1.Items.Clear()
In listTemplates
   4:     ListBox1.Items.Add(listTemplate.Name)
   5: Next

3.通过List template创建SPList

String)
   2:  
As SPListTemplateCollection = _site.GetCustomListTemplates(_web)
   4:  
As SPListTemplate = listTemplates(listTemplateName)
, listTemplate)
   7:  
End Sub

相关文章:

  • 2021-12-26
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-21
猜你喜欢
  • 2022-12-23
  • 2021-06-13
  • 2021-05-18
  • 2021-10-08
  • 2022-12-23
  • 2021-10-24
  • 2021-06-23
相关资源
相似解决方案