0

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..) ?

0
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.

Your Answer

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

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