protected void CreateDocLib() { SPSite site = SPContext.Current.Site; SPWeb web = site.OpenWeb(); SPListTemplateType templateType = SPListTemplateType.DocumentLibrary; Guid listId = web.Lists.Add("MyDocLibrary", null, templateType); SPList list = web.Lists[listId]; // create Text type new column called "My Column" list.Fields.Add("My Column", SPFieldType.Text, true); // make new column visible in default view SPView view = list.DefaultView; view.ViewFields.Add("My Column"); view.Update(); }}