Save a List Template in Sharepoint
Dim site As SPSite = SPContext.Current.Site
Dim web As SPWeb = site.OpenWeb()
web.AllowUnsafeUpdates = True
SPList lstSource = oSPWeb.Lists["SourceList"];
lstSource.SaveAsTemplate("FileName.stp", "Name", "Description", false);
lstSource.Update();
Delete a List Template in Sharepoint
Dim oSPsite As SPSite = New SPSite("http://myserver/site"))
Using oSPWeb As SPWeb = oSPsite.OpenWeb()
Dim objLstTempGallery As SPList = oSPWeb.Lists("List Template Gallery")
For Each objLstItem As SPListItem In objLstTempGallery.Items
If objLstItem.Title = "DEL_LIST_TEMPLATE_NAME" Then
objLstItem.Delete()
objLstTempGallery.Update()
Exit For
End If
Next
End Using
No comments:
Post a Comment