Question

i'm trying to achieve something that i'm not sure if it's possible or not.

I have a News system that uses multiple lists, permissions etc.

The permissions exist because only 1 person is able to approve/disapprove the news that are going to be shown on the Home Page. I have a list called "News - Home Approval" with 4 items "Approved, Waiting approval, Doesn't appear on the home page, Not Approved". I used a list for these items because only the administrator can see the options "Approved" and "Not Approved", but when anybody else is creating News, they see a dropdown list(lookup to the permission list) with the options "Doesn't appear on the home page" and "Waiting Approval".

The problem is, because of this 'permissioned' field, the common user (ones who only have permission to read content) can't see the items that are marked "Approved" on the lookup field.

With my user (admin) on the line:

 return (list.GetItems(q)).GetDataTable();

i always get 1 item (i have only 1 item on my News list and it's "Approved")

But when i'm using the common user, the same line returns 0 items.

i've tried using SPSecurity.RunWithElevatedPrivileges, but no success on that.

Not sure if i'm clear enough, but is there there a way to achieve what i'm trying to do?

Sorry for my crappy english.

Thank you.

Was it helpful?

Solution

You're looking for ModerationType = Moderator

You need to create an SPQuery as in this example to retrieve the listItems from your list but instead of in that example settting Scope Recursive instead set

oQuery.ViewAttributes = "ModerationType=\"Moderator\"";
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top