locked
Submit .Net, web based form to SharePoint List or Library RRS feed

  • Question

  • How do I submit data from a web based .Net form to a SharePoint list or library without using InfoPath?


    Thursday, December 13, 2012 3:15 PM

Answers

All replies

  • If I am correct, you are looking to submit a data from a .Net based form to a SharePoint list, Below are some of the options,

    1. You can use SharePoint Object Model to Add/Edit/Delete an item in the Sharepoint Library/List

    http://msdn.microsoft.com/en-us/library/ms467435(v=office.14).aspx

    2. You can use SharePoint Client Object Model to Add/Edit/Delete an item in the Sharepoint Library/List

    http://msdn.microsoft.com/en-us/library/ee539976(v=office.14).aspx

    3. Using SharePoint Webservices

    http://www.sharepointkings.com/2010/05/adding-list-item-to-list-using-web.html

    If my post is helpful, Please vote!

    If your think my solution worked for you, Please mark as Anwser!

    Thanks.

    Thursday, December 13, 2012 3:24 PM
  • These are wonderful. I'm a little unsure about passing credentials. How are the appropriate credentials passed using the SP Client Object Model? That's the last piece of my puzzle.  
    Thursday, December 13, 2012 5:04 PM
  • By default SharePoint will use windows credentials,

    http://zimmergren.net/technical/sp-2010-getting-started-with-the-client-object-model-in-sharepoint-2010

    sample code...

     try
           {
                SP.ClientContext ctx = new SP.ClientContext("yoursiteurl");
                ctx.Credentials = CredentialCache.DefaultCredentials;
                ctx.AuthenticationMode = SP.ClientAuthenticationMode.Default;
                ctx.ExecuteQuery();
                IEnumerable<SP.List> newLists;
                var query = from list in ctx.Web.Lists
                            where list.DefaultViewUrl == "/Shared Documents/Forms/AllItems.aspx"
                            select list;
                newLists = ctx.LoadQuery(query);
                ctx.ExecuteQuery();
                foreach (SP.List l in newLists)
                {
                    MessageBox.Show(l.Title);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

    If my post is helpful, Please vote!

    If your think my solution worked for you, Please mark as Anwser!

    Thanks.


    Thursday, December 13, 2012 5:18 PM
  • I want to make sure I am clear. I am using SharePoint 2007. 


    Thursday, December 13, 2012 5:20 PM
  • My Apologies, In this case you can only go for Option 1 (using SharePoint Object model) or Option 2 (SharePoint Webservices).

    Thursday, December 13, 2012 5:24 PM