0

I am querying for list items in a timer job. The list has moderation enabled. It has various list items that have different approval status (e.g. scheduled, approved etc.).

However the query always returns all items in "draft" mode and there is no way of querying for items with different approval status. The same happens when I log in to the site as System Account and view the library, it will show all items in draft status.

Why is the moderation status not visible for the system account? Other moderation info such as comments are showing.

Edit:

Impersonating the Site Owner account works fine and the query returns all moderationinformation. E.g.

SPUserToken token = site.Owner.UserToken;
var impersonatedSite = new SPSite(site.ID, token);
  • Does it display differently for other accounts? – RJ Cuthbertson Mar 27 '14 at 16:32
  • Yes it works correctly for other accounts. – hrobjartz Mar 27 '14 at 16:34
  • I have this issue too and I found it will always show draft if the item has been "declared as record". If it is undeclared", it would show the correct approval status. – user39529 Feb 11 '15 at 7:03
  • Thanks for the reply! I believe you are right. I noticed the same thing much later. – hrobjartz Feb 12 '15 at 12:58
0

As tony wu pointed out, seems this has to do with the items being locked as records. In our case, we were using in-place record management, which seems to affect the moderation status of item when viewing them as Sys admin or with an SPQuery.

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.