SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Task list in home page containing multiple task items,

Is it possible to approve multiple items at once, instead of one at a time (being redirected to the start page after each approval..) ?

share|improve this question
string Url = SPContext.Current.Site.Url.ToString();

            using (SPSite site1 = new SPSite(Url))
                using (SPWeb web = site1.OpenWeb())
                    web.AllowUnsafeUpdates = true;
                    SPUser me = web.CurrentUser;
                    SPList list = web.Lists["Tasks"];
                    SPQuery qurey = new SPQuery();
                    qurey.Query = "<Where><And><Or><Eq><FieldRef Name='AssignedTo' LookupId='TRUE'/><Value Type='Integer'><UserID /></Value></Eq><Membership Type='CurrentUserGroups'><FieldRef Name='AssignedTo'/></Membership></Or><Eq><FieldRef Name='Status' /><Value Type='Choice'>Not Started</Value></Eq></And></Where>";
                    qurey.ViewFields = "<View><Query><OrderBy><FieldRef Name='ID' Ascending='False'/></OrderBy></Query></View>";
                    qurey.RowLimit = 2;                    
                    SPListItemCollection items = list.GetItems(qurey);
                    //TaskGrid.DataSource = items.GetDataTable();
                    if (items.Count != 0)
                        foreach (SPListItem taskitem in items)

                            Label1.Text = "Next Task Item ID" + taskitem["ID"];
                            var itemd = taskitem["ID"];
                            if (taskitem["ID"] != null)
                                Response.Redirect("" + "ID=" + itemd + "&ContentTypeId=0x010800C403738557E42A48815786B56111DD3C");

                    else {


Event Fire After Approve the Task and Get The Next Task Related to Current User using SPQurey.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.