How to Create Custom List in SharePoint 2010 Programmatically ?

Hi,
i have tried the following way, 
http://devendra-sharepoint.blogspot.in/2012/01/creating-list-programatically-in_30.html
But i am not able to create list.
Becuase i am getting the following error.
'Microsoft.SharePoint.SPWeb' does not contain a definition for 'EnsureList' and no extension method 'EnsureList' accepting a first argument of type 'Microsoft.SharePoint.SPWeb' could be found (are you missing a using directive or an assembly reference?)
Please advice.
Thanks,
Aasai

Hi,
You can use list.Fields.Add() to add column in list. See below blog:
http://www.c-sharpcorner.com/blogs/3764/create-sharepoint-list-programmatically.aspx
Use this to delete list:
http://www.c-sharpcorner.com/UploadFile/54db21/delete-list-in-sharepoint-2010-programmatically-using-vs-201/
See this for remove user/group from list:
http://www.c-sharpcorner.com/UploadFile/54db21/remove-group-permission-to-list-in-sharepoint-2010-programma/
Hope it could help
Hemendra: "Yesterday is just a memory,Tomorrow we may never see"
Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
you see a reply being an answer to the question of the thread, click "Mark As Answer

Similar Messages

  • How to manage big custom list in SharePoint 2010

    Hi All experts,
    I am working on Time Attendance Management System, where I have to generate a weekly schedule at once for each employee every year.
    Custom List columns are
    Employee Number
    Employee Name
    From Date(Mon)
    To Date(Sun)
    Total numbers of employees are: 2800
    Eg: In January 2015(5 weeks): 5 * 2800 = 14000 items
    Likewise total, if I generate one year schedule which contains 53 weeks (53* 2800 = 148400 items/year)
    How to overcome with the below problems
    List threshold limit which is 5000
    Efficiency of list
    How can I manage such a big list? Can someone please suggest me here?
    MercuryMan

    Hi MercuryMan,
    Possible ideas regarding you problems are:-
    1. Increase size list and take timely back up delete list item from source list ( but problem of maintenance every now and then, not completely feasible.)
    2. Better to store all the entries in the database (ex: SQL) and so in this way you won't have to worry about growing list item numbers. But for this, you need database access to save and retrieve.
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • How to Archive a list in sharepoint 2010

    Hi
    I think large list is the inevitable trend and will be a very common issue faced by everyone. We are a medium business using sharepoint 2010.
    For past 3 years, one of our SharePoint lists is over 20000 items.
    From my end:
    1.     I have indexed some important columns and created filtered views but it does not help much.
    2. I have increased the list threshold value to 25000( Even though the best practice is 5000).
    3. Also,  I have set the list template size to 500MB 
    4.     When I try to save the list as a template,  SharePoint throws an exception error.  
    5.   I tried working on the code
    mentioned in the link
    below but it looks complicated for me.
    http://spboom.com/sharepoint-development/moving-sharepoint-list-items-to-archive-list/
    What I need:
    I need to archive old items in the list.  After archiving,  I might need to refer to the archived items from time to time.
    As I'm newbie to SharePoint, it would be great, if someone can elaborate in detail with what can be done.
    Again your help in this is much appreciated.
    Thanks & Regards,
    SweR

    What vesion of SharePoint are you using?  If you want to move items across from one list to another (as per your prefered option), something like: -
    Create a list template of you list with no content
    Recreate it on the same level as the main lis
    Create an SPD workflowthat'll copy an item to the new list and delete the original.  Make sure it doesn't have a triggering action
    Use an Expiration Information Rights Policy to triger the workflow. 
    Please note that this won't preserve the original author / create metadata as Alex has already said.
    Cheers,
    Steven Andrews
    SharePoint Business Analyst
    Blog:
    Steve's SharePoint Space  Twitter:
      LinkedIn:
      Facebook:
    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  • How to activate Custom Feature in SharePoint 2010 using Client Object model

    I am trying to Activate a custom feature using Client Object Model in SharePoint 2010. Here is the code I used. When I execute the code, I got the error "Feature with Id 'xx' is not installed in this farm, and cannot be added to this scope while
    creating site collection". Can anyone help?
    ClientContext clientContext = new ClientContext(spURL);
    //GUID of the custom feature                    
    Guid districtFeatureId = new Guid("5b3529de-5045-46da-af87-8d2e32c121a7");
    Site clientSite = clientContext.Site;
    FeatureCollection clientSiteFeatures = clientSite.Features;
    clientContext.Load(clientSiteFeatures);
    clientContext.ExecuteQuery();
    //Activate the feature
    clientSiteFeatures.Add(districtFeatureId, false, FeatureDefinitionScope.Site);
    clientContext.ExecuteQuery();

    Hi shil chan,
    When you activate a feature on the site collection, the feature should be scoped to site or farm, the error message shows it cannot find the specific feature, this will happen when you have a feature in web
    scope or the feature isn’t installed.  
    So, to troubleshooting this issue:
    Verify whether the feature is scoped to web. Please go to
    Site Setting->Site Features . If the feature is a web scope feature, then add the feature to webfeatures.
    Make sure the feature is installed correctly.
    Please inform me freely if you have any questions.
    Thanks

  • How to create purchase order using SharePoint Custom List

    Hi All,
    Can you please provide some example or link to create Purchase Order using SharePoint List / SharePoint Designer.
    Thanks

    Hi,
    It would be difficult to achieve what you want with the OOTB features of only one list.
    Per my understanding, there would be two main functionalities in the solution you want:
    1. Calculate and display the “Balance Qty” dynamically based on the values of “Order Qty” and “Deliver Qty”;
    2. Trace the “Deliver Date” and “Deliver Qty” as per “Purchase No”;
    As a workaround, I would suggest you create two lists as below:
    1. List “Orders”: Saving the upcoming orders per “Purchase No”, one “Order Qty” related to one unique “Purchase No”.
    Columns in this list:
    Purchase No(Number);
    Order Date(Date);
    Order Qty(Number);
    2. List “Deliveries”: Recording each delivery, one “Deliver Qty” to one unique existing “Purchase No” in list “Orders”.
    Columns in this list:
    Purchase No(Lookup “Purchase No” in list “Orders”);
    Order Date(Additional Lookup column along with “Purchase No”);
    Order Qty(Additional Lookup column along with “Purchase No”);
    Deliver Date(Date);
    Deliver Qty(Number);
    Balance Qty(Number);
    More information about
    Lookup column in SharePoint List:
    http://msdn.microsoft.com/en-us/library/office/ff728095(v=office.14).aspx
    http://zimmergren.net/technical/sp-2010-how-to-relational-lists-in-sharepoint-2010
    In the “Deliveries” list, we can trace each “Deliver Qty” and “Deliver Date” easily by filtering the “Purchase No” column in the list view page.
    For the dynamic values in “Balance Qty” column, Event Receiver with custom code would be needed as we will need to query the “Order Qty” in “Orders” list and all the
    existing “Deliver Qty” value per “Purchase No” in “Deliveries” list.
    An idea about
    how to implement a Purchase Order system in this blog would be helpful:
    http://ethan-deng.blogspot.jp/2013/03/purchase-order-management-system.html
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • How to create time column in SharePoint custom list.

    Hi,
    Actually my requirement is, I should create a Custom List in SharePoint which should has "Effort" column with the "Time" type.
    User Should enter only Hours and minutes in that field. How should i do it?
    By Default we can have "Date and Time" or "Date" alone. There is no feature to have only "Time" :(
    Thanks in advance.
    Poomani Sankaran

    you can use JSLink script for that. You can use text field attache JSlink script and change her client side rendering. some information and samples about client side rendering: https://code.msdn.microsoft.com/office/Client-side-rendering-JS-2ed3538a
    I's good because in worst case you will have pure SP text field. In case of migration to new version or cloud you will have no problems. 
    Even more you can attache Jquery UI Time spinner http://jqueryui.com/spinner/#time or you can download Time picker extension http://trentrichardson.com/2010/04/19/timepicker-addon-for-jquery-ui-datepicker/
    and create fancy time picking design.
    Tomas.

  • Creating custom lists that are links to SharePoint sites.

    I am new to SharePoint 2013 Online and was wondering if there is a non-coding way to build a sub-site from a template that is not initially connected to a site collection. Attach this sub-site to a site an already existing site collection afterwards and
    use data from the sub-site that is created, to generate a custom list items that can also be used as links to the sub-site itself.
    How I thought this might work would be to create templates for site collections (if that is even possible), and then use a links list or some other type of linked list but not exactly sure how this is done in SharePoint.
    Any input on how to go about this would be greatly appreciated as well as any insight as to whether this is even possible to do with out coding. Thanks in advance.

    Hi,
    According to your post, my understanding is that you wanted to create custom lists that are links to SharePoint sub-sites.
    I recommend to create a custom list and add a multiple line column to display the sub-sites url.
    Then create a workflow associate a custom list and use “Call HTTP Web Service" action and “Build Dictionary" action to get the count of the sub-sites.
    Then use the Loop Stage to create a new item in the custom list and set the multiple line column to the url you get in the dictionary.
    Here is a great blog for you to take a look at:
    http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/
    In addition, you can use the build-in webservice via SharePoint Designer.
    More information:
    http://www.balestra.be/2012/03/show-all-subsites-on-a-sharepoint-2010-page-without-code-via-sharepoint-designer.html
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • How to raise mail notification when ever the new event is added to calendar list in sharepoint 2010?

    Hi experts, I need guidance or the way how we can raise mail,
    When ever the new item is added / updated / deleted / cancelled to a calendar list in SharePoint 2010.
    Shall we achieve it through using SharePoint designer 2010.
    If its help to fix the requirement.
    Thanks and Regards,
    Dhayanand Kalimidi

    >I need to send the mail before 1 week from the date
    This is different requirement. Initially you said you want send email when item is added / updated / deleted in list. For this you can use default alert to send instant email as  suggested before. 
    Now if you want to send reminder email then you can use designer WF and calculate the due date by using variable. Refer this link for your ref:
    http://mysharepointchronicles.wordpress.com/2012/11/05/sharepoint-list-with-workflow-email-reminder-set-to-send-30-days-from-created-date/
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3211ee00-92de-47f1-b611-4c9609f92ab7/how-do-i-set-sharepoint-2010-to-send-a-reminder-email-a-month-after-a-date-already-listed?forum=sharepointdevelopmentlegacy
    Remember event receiver can not send reminder email or scheduled email so for this either use designer WF or create timer job.
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to create custom content placeholder in sharepoint 2013

    Hi, I would like to create custom content placeholder don't know how to and add to my custom master page in sharepoint 2013. I have no luck searching on how to create custom content placeholder, any help?
    Thanks,
    Johnweb

    Hi,
    If you’re not fixed your requirement with the Out of the box SharePoint place holders, you can create as many as you want as long as the ID doesn’t conflict. On the master page add the content place holder 
    <asp:ContentPlaceHolderid="CustomName" runat="server"></asp:ContentPlaceHolder> and add this to your page layout
    <asp:Contentrunat="server" ContentPlaceHolderID="CustomName"></asp:Content>.
    I suggest you provide your basic requirement for further research.
    If you want to customize a master page, the Rajendra's method would be helpful.
    Best Regards,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to make users to select the date from calendar control my making the date field read only in date time control in external list in sharepoint 2010

    How to make users to select the date from calendar control only, by my making the date text field read only (don't want to let users type the date) in date time control in external list in sharepoint 2010. I am looking for a solution which can
    be done through sharepoint desginer / out of the box.
    thanks.

    Congratulate you got the solution by yourself. I am new to a
    WinForms calendar component, I feel so helpless on many problems even I'd read many tutorials. This question on the
    calendar date selection did me a great favor. Cheers.

  • How go generate Popularity Trends report for a custom list in SharePoint 2013

    Hi, 
    I want to generate  Popularity Trends report for a custom list in SharePoint 2013, is it possible?
    Thanks
    khadar pasha

    According to
    this link you should be able to access this option from the Items tab. for this to work, the Analytics Processing Component needs to be running.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Custom list in Sharepoint 2013 for training booking purpose

    Kindly note that I am trying to  do custom list in Sharepoint 2013 for training booking purpose
    As below :
    The user should enter the user name  - it works fine
    The user should select the data from the choice list
    The requirement is , I need to limit in each  day of the training 20 seats (20 booking only) only
     Can you advise how to do so.
    [email protected]
    Basil

    check below post and video on how to build the event receivers
    http://www.sharepointpals.com/post/How-to-create-a-custom-list-level-event-receiver-in-SharePoint-2013-and-SharePoint-2010
    https://www.youtube.com/watch?v=wZf2xvEM5Io
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • Create Custom List, store information and display the information on web part

    Hi,
    Working on a Custom visual web part in sharepoint 2010. Scenario is i would like to have two button on that web part, one is "I read it " button for users to tag the page and another one is "find the list of people who already tag/read that
    page". i have added a visual web part into my project and two buttons event within it. Now goal is once user click on "I read it button" it will create custom list to store urls and usersname. When click on "Find the list of people"
    get the username only for that specific page whoever read/tag it.
    1. How can i create the custom list to store all users information
    2. Retrieve the information from Custom List and Display the list of people based on specific page url who ever read/tag that page. 
    Any help will be greatly appreciated!

    Appreciated for your help!
    List has four columns Title, Hyperlink, Created by, and created. i just wanted to display Users and hyperlink column. i tried to retrieve the items from list but query is not returning any items and displaying. As you said in CAML query we can pass the page
    url to get the collection of user for that particular page. but is not something will be hard coded value, if we pass the page url into CAML query? is there something we can dynamically retrieve the users based on page url.  for example, if users visits
    30 different page url, i need to put all those urls into CAML Query. do i need to create custom user field or i can use Created by field to get the users? please correct me if i am wrong. Below is the code:
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using System.Data;
    namespace CustomUserControl.VisualWebPart1
        public partial class VisualWebPart1UserControl : UserControl
            protected void Page_Load(object sender, EventArgs e)
            protected void btnRead_Click(object sender, EventArgs e)
                using (SPSite site = new SPSite(SPContext.Current.Web.Site.ID))
                    using (SPWeb web = site.OpenWeb())
                        web.AllowUnsafeUpdates = true;
                        SPList list = web.Lists["UserInformation"];
                        SPListItem newItem = list.Items.Add();
                        SPFieldUrlValue hyper = new SPFieldUrlValue();
                        //hyper.Description = "Google";
                        hyper.Url = System.Web.HttpContext.Current.Request.Url.AbsoluteUri.ToString();
                        newItem["Hyperlink"] = hyper;
                        newItem.Update();
                        web.AllowUnsafeUpdates = false;
            protected void btnDisplay_Click(object sender, EventArgs e)
                SPWeb web = SPContext.Current.Web;
                SPList list = web.Lists["UserInformation"];
                SPQuery query = new SPQuery ();           
                query.Query = "<Where><Eq><FieldRef Name='Hyperlink' Type='URL' /><Value>http://nyc01d1sptmp01:8080/diligent/wiki/cft/Pages/home.aspx</Value></Eq></Where>";
                DataGrid grdList = new DataGrid();
                SPListItemCollection items = list.GetItems(query);
                DataTable table;
                table = new DataTable();
                table.Columns.Add("Title", typeof(string));
                table.Columns.Add("Hyperlink", typeof(string));
           table.Columns.Add("Created by", typeof(string));
                DataRow row;
                foreach (SPListItem result in items)
                    row = table.Rows.Add();
                    row["Title"] = result.Title;
                    row["Hyperlink"] = result.Name;
           SPFieldUser userField = (SPFieldUser)result.Fields.GetField("Users");
                    SPFieldUserValue userFieldValue = (SPFieldUserValue)userField.GetFieldValue(result["Users"].ToString());
                    SPUser user = userFieldValue.User;
                    string name = user.LoginName;
           row["Created by"] = name;
                grdList.DataSource = table.DefaultView;
                grdList.DataBind();

  • Ribon mising when first opening a list in Sharepoint 2010

    Hello.
    When opening a list in SharePoint 2010, I do not get the ribbon. If I click on a list item, the ribbon appears. Then I can come back to the original task I had in mind.
    Can you advise how to fix it so that the ribbon always appear when loading a list?
    Thanks a lot.

    Thanks dear Alex,
    Probably... I am not the programmer, but the user. The programmer told me that it was impossible to have the ribbon available unless an item of the list is clicked on first, so I wanted to investigate if that is true and if there is a way around it. Does
    not seem natural to have to open an item on the list before creating a new one.

  • How to create new scope for SharePoint calendar?

    How to create new scope for SharePoint calendar?
    I have a calendar list to which I want to create following scopes-
    Annual View
    Half Year 1 (Jan-June)
    Half Year 2 (Jul-Dec)
    Quarter 1 (Jan-Mar)
    Quarter 2 (Apr-Jun)
    Quarter 3 (Jul-Sep)
    Quarter 4 (Oct-Dec)
    How this can be created. Any help appriciated. Thanks.

    Hi Pratima,
    Can you please see below link and code snippet for how to
     format date in gridview.
    http://www.aspdotnet-suresh.com/2011/05/how-to-set-date-format-in-gridview.html
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Gridvew Date format</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:GridView runat="server" ID="gvdetails" DataSourceID="dsdetails" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="false">
    <RowStyle BackColor="#EFF3FB" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <AlternatingRowStyle BackColor="White" />
    <Columns>
    <asp:BoundField DataField="Date1" HeaderText="Date1" HtmlEncode="false" DataFormatString="{0:s}" />
    <asp:BoundField DataField="Date2" HeaderText="Date2" HtmlEncode="false" DataFormatString="{0:D}" />
    <asp:BoundField DataField="Date3" HeaderText="Date3" HtmlEncode="false" DataFormatString="{0:m}" />
    <asp:BoundField DataField="Date4" HeaderText="Date4" HtmlEncode="false" DataFormatString="{0:d}" />
    <asp:BoundField DataField="Total" HeaderText="Total" HtmlEncode="false" DataFormatString="{0:C2}" />
    </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="dsdetails" runat="server" SelectCommand="select * from DateFormat" ConnectionString="<%$ConnectionStrings:dbconnection %>"></asp:SqlDataSource>
    </div>
    </form>
    </body>
    </html>
    Hope this will help you.
    Regards
    Soni K

Maybe you are looking for

  • How to create printable report from a swing app.

    Hi, I have googled quite a bit and have searched the forum extensively but haven't found answers to my questions. I have a small swing based application (that uses jtextfields, jbuttons, jlist, etc) that collects information from user and stores in s

  • How to see the data after deploying

    Hi, I installed owb 9.2.0.2 and created a test mapping and deployed it successfully. It inserted few rows in my table. How can i see the data which was inseted other than SQLplus. Can i view data trough any OWb reports or do I need to use discoverer

  • Video Based AE files in Captivate 5.5

    I'm probably an idiot to be asking this now, but .... should I be concerned about crashes if we build a course with 8 modules of video based content where the file size averages around 50mg per module? To create a graphic novel look'n'feel, we have c

  • Source of data for Z fields

    Dear Gurus, What is the source of data for Z custom fields ? Do we need to create any tables for these fields in the source system ? Do we call it as enhancement when we add a Z field or populate an existing field (Unused) in the standard data source

  • How do I expand albums in photoshop

    would like a solution to the above problem