Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Unable to get the pending item in the query

  Asked By: Tanya    Date: Dec 11    Category: Sharepoint    Views: 652

I just wrote a webpart to get item from a list according to the ID
and was able to get the items that are approved. Yes, i use the
control Required Approval for the list. The webpart i wrote contains
a query to pick the item according to the ID but unable to get the
items that are in pending or rejected status. Anybody had this
problem before? or am i missing with something? i need some help on
this. I have given the code below.

\\think only this chunk is required to solve the problem
SPSite site = new SPSite("http://test");
SPWeb web = site.AllWebs["sites/testsite"];
SPList list = web.Lists["test"];

SPQuery query = new SPQuery();
int ID = int.Parse(Context.Request.Params["ID"]);

query.Query = "<Where><Eq><FieldRef Name='ID'/><Value

Please i need some help in this matter,
Thank You.

SPListItemCollection listItems = list.GetItems(query);

foreach (SPListItem listItems1 in listItems)
CreatedUser = listItems1["Created By"].ToString();
int num = CreatedUser.IndexOf(";");
int userID = int.Parse(CreatedUser.Substring(0,num));
SPUser user = web.AllUsers.GetByID(userID);



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on Unable to get the pending item in the query Or get search suggestion and latest updates.