I am working on a publishing site collection using the Enterprise wiki template. Currently I got this behavior regarding the versioning setting. For the library I specify that the library content needs approval and that any user with read permission can view the pending content.

So now if a user edit the page, its status will be pending and the following message will be shown on the top of the wiki page:-

enter image description here

The above looks fine as users can know that they are reading a non-approved content and they can view the page history to read the approved version.

But the problem is when a pending wiki page got rejected. So all the users will be reading a rejected wiki page, without knowing this , since no message will be displayed.

So i am trying to implement any of these , but i can not find a way:-

  • To display a red message at the top of the wiki page if it’s status is rejected (Prefered).
  • OR To not allow users to view Rejected content. This can be force if I changed the versioning setting to be :-

enter image description here

But I do not want this setting since users will not be able to see pending contents also , which I want to avoid.

So can anyone advice who to implement any of the above two points?

  • so can anyone advice on this please. as it seems the default scenario for the publishing site is some how misleading. as rejected pages can be read by all users , and no indication about the page status. for example if the page status is pending a yellow message will be displayed to the users so they can know that the page they are reading is pending. while if the page has been rejected no alert message will be displayed..
    – John John
    Commented Aug 28, 2014 at 23:32

3 Answers 3


How about something like this:

<script type="text/javascript">

ExecuteOrDelayUntilScriptLoaded(showStatusAlert, "sp.js"); 

function showStatusAlert(){

    var ctx = SP.ClientContext.get_current();
    var web = ctx.get_web();
    var list = web.get_lists().getById(_spPageContextInfo.pageListId);
    var item = list.getItemById(_spPageContextInfo.pageItemId);



            var status = item.get_item('_ModerationStatus');
            // 1 - rejected
            if(status == 1){
            statusDesc = SP.UI.Status.addStatus("Warning, this has been rejected!");
                SP.UI.Status.setStatusPriColor(statusDesc, 'red');

        , function(err){ 


Works in my environment.

  • Thanks for expanding my solution - my jquery knowledge is minimal
    – XristosK
    Commented Sep 3, 2014 at 21:41
  • should i add the script inside the Enterprisewiki page layout ?
    – John John
    Commented Sep 5, 2014 at 0:53
  • 1
    Yup, that should do it. Commented Sep 5, 2014 at 1:28
  • 1
    Yes sorry, it should be "if( status == 1 )". I updated the snippet. Commented Sep 5, 2014 at 14:37
  • 1
    I agree, you could send MS some feedback @ officespdev.uservoice.com . At least they gave us the api's allow us to get the job done. Commented Sep 9, 2014 at 12:16

I have worked with a content approval process for an enterprise wiki recently. Here's how I did it.

In order to have this work you need to turn on content approval for the list that you want to be approved. In our case we used the 'Pages' document library. In this you go to Library Settings -> Versioning Settings -> Content Approval. Here you can require content approval for submitted items. We also turned on major and minor versioning which helps with comparing approved items and rejected items. We also turned on require check out. This allows the editor of the wiki page to save changes to themselves before submitting their desired changes.

The next part is to open SPD and go to Workflows. Right-click the existing OOTB 'Publishing Approval' and click 'Copy and Modify'. Name it and edit the workflow. Click on the task workflow within it. Then click 'Change the behavior of the overall task process'.

Change the workflow where there is a flag checking if the workflow is set to run on item edited. At those spots change the workflow to take out the conditionals to run only on new item.

This is located in the 'When the Task Process Completes' Stage.

Look for 'If Variable: IsItemApproved equals Yes'. Take out the conditionals after that so it sets the statuses to Approved or Rejected based on the task.

After this, save and publish the workflow. Now in the Pages document library go to workflow settings and find the workflow you made and select it. Then follow create your settings by filling out the forms and you should have a functioning content approval workflow.

For me, I have it set up so there is a Visitors group, Contributors group, and Approvers group. The Approvers get the task sent to them after a change has been made to a page. By default with this workflow, the contributor that made the change will get an email stating the workflow has started and let them know when the page is Approved/Rejected. Anyone in the visitors group will not see any changes until the page has been published/approved.

  • so what if the page has been rejected.. then visitors will be seeing a rejected page, and no warning message will be displayed to them...
    – John John
    Commented Sep 3, 2014 at 15:40
  • 2
    No, Visitors will not see the rejected page. They will see the last approved page. Only the Approvers and Contributors will see the rejected page, which will stay there until there is a new approved page.
    – Jordan
    Commented Sep 3, 2014 at 16:25
  • But how you will force visitors to only see approved pages, if you specify that "any one how can read items" , can see draft version inside the library settings ?
    – John John
    Commented Sep 3, 2014 at 16:57
  • 1
    Change the Draft Item Security setting in your versioning settings to 'Only users who can approve items (and the author of the item)'. Sorry I misspoke about both groups being able to see the rejected/pending page. It will be the full Approvers group and then only the Contributor themselves, not the whole group.
    – Jordan
    Commented Sep 3, 2014 at 17:12

Use Rest to find the Approval status and write an appropriate message

The field is : Data_ModerationStatus

You can see how rest works at: http://msdn.microsoft.com/en-us/library/office/jj860569(v=office.15).aspx (video). Also, use the http://dlr2008.wordpress.com/2013/12/05/sharepoint-2013-rest-api-testing-for-the-existence-of-a-document-in-a-document-library/ to get the wikipage metadata ( you can get its url with Javascript). If you need more info. comment me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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