views:

111

answers:

1

How to use of SPListCollection.Add Method (String, String, String, String, Int32, String, SPListTemplate.QuickLaunchOptions) for creating sharepoint document library programmatically using asp.net? or Can you plz show me steps for creating document library programmatically/dynamically using asp.net in Itemadding event?

Thanks in advance Hiral

A: 

Adding a document library that appears on the Quick Launch area

Hard way - using the Add(String, String, String, String, Int32, String, String, SPFeatureDefinition, SPListTemplate.QuickLaunchOptions) method overload

web.Lists.Add("Old documents",
  "This library stores old documents.",
  "old-docs",
  "00BFEA71-E717-4E80-AA17-D0C71B360101",
  101,
  "101",
  SPListTemplate.QuickLaunchOptions.On);
  • the featureId parameter (4th one) is a string that contains the ID of the feature that defines the list; you can find feature IDs of standard list definitions online (here, here or here) or in appropriate files in the 12 hive

Easy way - in 2 steps

Guid newListGuid = web.Lists.Add("Old documents",
  "This library stores old documents.",
  SPListTemplateType.DocumentLibrary);

SPList newList = web.Lists[newListGuid];
newList.OnQuickLaunch = true;
newList.Update();
Marek Grzenkowicz
Thanx Marek.But can you please explain by example that how to use this add method with QuickLaunch Options? I don't know how to use this function with all parameters.
Hiral
Thanx again.I don't know what i pass in Feature id parameter(4th parameter in add method) for document library?
Hiral
No, I don't want to show/hide any link.But when i create any item "IT" into particular list say department, at that time i want to create document library "IT" dynamically.And i also want to display that library in quick launch.For that reason, i am using above add method but i don't know how to pass Feature id parameter(4th parameter in add method) in add function?
Hiral
Ok thanks for ur help.
Hiral