Create folder programatically in SharePoint Document library
Step By Step Guide to Create a Task List in SharePoint
Step By Step Guide to List Events Handling in SharePoint
Insert Multiple User in SharePoint list
SharePoint List Tutorial
Populating file names from SharePoint Document library in a drop down list
Programmatically adding document to SharePoint Document library
SharePoint 2010 Base Types, List Template and Definition IDs, and Content Types IDs
Create Custom Lists in CAML based on existing List Templates
How to determine your list template
Display All Base Content Type id
How to: Add a Content Type to a Site
Displaying Data by Using the SPGridView Control in Windows SharePoint Services 3.0
SharePoint 2010 List Definition using Visual Studio 2010
How to: Create an External Content Type Based on a Web Service
How to: Create an External Content Type Based on a SQL Server Table
Attributes for AD Users (Windows 2000 / Windows 2003)
Restore Deleted Site/Site Collections in SharePoint 2010 - SP1
List of Share Point 2007 site template names
Display Name Template name
Team Site STS#0
Blank Site STS#1
Document Workspace STS#2
Wiki Site WIKI#0
Blog BLOG#0
Basic Meeting Workspace MPS#0
Blank Meeting Workspace MPS#1
Decision Meeting Workspace MPS#2
Social Meeting Workspace MPS#3
Multipage Meeting Workspace MPS#4
Document Center BDR#0
Records Center OFFILE#1
Personalization Site SPSMSITE#0
Site Directory SPSITES#0
Report Center SPREPORTCENTER#0
Search Center with Tabs SRCHCEN#0
Search Center SRCHCENTERLITE#0
Publishing Site CMSPUBLISHING#0
Publishing Site with Workflow BLANKINTERNET#2
News Site SPSNHOME#0
Deleting all items from lists
----------------------------------
* Create a new console application and add reference to Microsoft.SharePoint.dll
* Use the below code.
using System;
using Microsoft.SharePoint;
using System.Collections.Generic;
using System.Text;
namespace SKN.CleanSPLists
{
class Program
{
static void Main (string[] args)
{
string webUrl = "http://ws2003";
bool deleteFromRecycleBin = true;
List
listNames.Add("List Title 1");
listNames.Add("List Title 2");
listNames.Add("List Title 3");
listNames.Add("List Title 4");
using (SPSite site = new SPSite(webUrl))
{
using (SPWeb web = site.OpenWeb())
{
foreach (var listName in listNames)
{
SPList list = web.Lists[listName];
Console.WriteLine("Purging list: " + list.Title);
Console.WriteLine("Base Type: " + list.BaseType.ToString());
StringBuilder sbDelete = BuildBatchDeleteCommand(list);
web.ProcessBatchData(sbDelete.ToString());
Console.WriteLine("Done cleaning list : Presss a key to continue with next list.");
Console.WriteLine("");
Console.ReadKey();
}
if (deleteFromRecycleBin)
{
Console.WriteLine("Cleaning Recycle bin");
web.RecycleBin.DeleteAll();
site.RecycleBin.DeleteAll();
Console.WriteLine("Done cleaning Recycle bin");
Console.ReadKey();
}
}
}
}
///
/// Builds a batch string with a list of all the items that are to be deleted.
///
/// ///
private static StringBuilder BuildBatchDeleteCommand (SPList spList)
{
StringBuilder sbDelete = new StringBuilder();
sbDelete.Append("
string command = "
"
foreach (SPListItem item in spList.Items)
{
sbDelete.Append(string.Format(command, item.ID.ToString()));
}
sbDelete.Append("
return sbDelete;
}
}
}
Click here
Create Site Definition and Staple list definition/instance Features
Creating a new SharePoint site programmatically
Add an event receiver to a specific list programmatically
All About List/Site Definition
SharePoint 2010 Feature Stapling
Building a SharePoint custom site definition with a project tasks list and a listviewwebpart in Gantt view on the homepage.
SharePoint 2010 site templates not showing in create site page, How to get them?
SP 2010: How To - Relational lists in SharePoint 2010
How to use Sharepoint Lookup fields, Part 1.
Provisioning a SharePoint 2010 Lookup Column with CAML
SharePoint: Creating a custom field
SharePoint Feature Stapling
Create SPFieldLookup programatically
http://sp2010filteredlookup.codeplex.com/
Dynamically Creating Sharepoint Content Type
No comments:
Post a Comment