1

I'm new to C#, ASP.Net

I am trying to populate 2 SharePoint Lists off 1 submit button.

C# code: public partial class Default : System.Web.UI.Page { static Uri _site = new Uri("https://berkeleycollege365.sharepoint.com/sites/operations"); string realm = TokenHelper.GetRealmFromTargetUrl(_site);

    protected void submit(object sender, EventArgs e)
    {

        using (ClientContext clientContext = TokenHelper.GetClientContextWithAccessToken(_site.ToString(), GetAccessToken()))
        {
            List list = clientContext.Web.Lists.GetByTitle("Maintenance Requests");
            ListItemCreationInformation info = new ListItemCreationInformation();

            Microsoft.SharePoint.Client.ListItem entry = list.AddItem(info); 
            entry["Title"] = "2018 Submission";

            entry.Update();
            clientContext.Load(entry);
            clientContext.ExecuteQuery();
            Server.Transfer("re-direct.aspx");
        }
    }

I would want to combine with this: C# code: --> so that when a user clicks submit, both databases get filled in.

static Uri _site = new Uri("https://berkeleycollege365.sharepoint.com/sites/berkeley_shared");
string realm = TokenHelper.GetRealmFromTargetUrl(_site);
protected void submit(object sender, EventArgs e)
{   
    using (ClientContext clientContext = TokenHelper.GetClientContextWithAccessToken(_site.ToString(), GetAccessToken()))
    {
        List list = clientContext.Web.Lists.GetByTitle("EventForm"); 
        ListItemCreationInformation info = new ListItemCreationInformation();
        Microsoft.SharePoint.Client.ListItem item = list.AddItem(info);
        item["Title"] = "2018 Submission";

each uses a GetAccessToken()

and the HTML/ASP.Net:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.