Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer 1

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();
                    //TaskGrid.DataBind();
                    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("http://site.com/Lists/Tasks/DispForm.aspx?" + "ID=" + itemd + "&ContentTypeId=0x010800C403738557E42A48815786B56111DD3C");
                            }


                        }
                    }
                    else {

                        Response.Redirect("http://site.com");
                    }

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

share|improve this answer
add comment

Your Answer

 
discard

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.