Microsoft 开发人员网络 > 论坛主页 > SharePoint - Workflow > Hiding standard Approve/Reject options
提出问题提出问题
 

问题Hiding standard Approve/Reject options

  • 2008年3月11日 15:08Brian Halkjær 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    Hi,

     

    I have a document library, where I am using a custom workflow for approval, which relies on the approver role. I would like for this workflow to be the only way that documents can be approved. The workflow forces a number of approvers to approve the document in sequence, and no single person with the approver right should be able to approve the document without involving the other approvers. I would like to disable all other mechanisms of approval. By customizing the java script I have successfully removed the Approve/Reject menu item in the documents context menu. Now what I need to do is:

     

    1. Remove the Approve/Reject menu item on the display and edit forms (this seems not to be a custom action, at least I cannot figure out which one it is. If it was, I could just make a HideCustomAction feature).
    2. Disable the _layouts/approve.aspx page, as this would enable skilled users to gain access to the approval functionality even though there are no menu items - simply by typing the correct URL.

     

    I hope that someone will be able to help me out on this, as it is quite cruisial to our system, that all approvers must participate.

     

    Thanks,

     

    Brian

全部回复

  • 2008年4月14日 6:36aifong 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    Did you manage to get the resolution for this? I have a similar requirement.

  • 2008年4月14日 7:36Brian Halkjær 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    No, at least not in a pretty way.

     

    As mentioned, I have removed the item from the context menu by supplying a custom js file.

     

    Now what we do is modify the default _layouts/approve.aspx through code in a feature receiver. We inject a little modification (if not already injected when activating the feature on another site using our template) which checks what site template and configuration is used by the current web. If it is in fact our site template and a specific configuration, we redirect to the _layouts/workflow.aspx page with the same query parameters (that way targeting the same document), allowing the user to start an approval workflow instead. For all other requests to approve.aspx the page processes normally.

     

    Of course, this is not a nice way to do such things. It is clear, that our modifications might be wiped out, when our clients install a service pack or a hotfix. But it is the only solution we have been able to come up with so far, and we have highlightet this fact in our documentation, so that administrators can make sure, that the modification is still present after having installet service packs etc.

     

  • 2008年4月15日 8:05aifong 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    I found a way! Actually, it's simpler than I thought.

     

    Simply remove Approval rights for the Approvers group. That will effectively hide the Approve/Reject button in both instances. In that way, the workflow will do the approving for them so they can't by-pass anymore.

     

    Hope that helps anyone else who might have been facing this.

  • 2008年4月15日 9:04Brian Halkjær 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    Hi

     

    The solution you propose has a major disadvantage. The Approval right makes the approvers able to actually see the draft version of the document which they are about to approve. Without that right they are not able to review the changes that are about to be published.

     

    Brian 

  • 2008年4月15日 10:08Manish_Goyal 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    I have come across a web part which can be used to hide the menu button options from the Share Point toolbars. See this at: http://scothillier.spaces.live.com/blog/cns!8F5DEA8AEA9E6FBB!280.entry?wa=wsignin1.0

     

    Hope this can be helpful for you.

     

    Manish

    http://manish-sharepoint.blogspot.com/

  • 2008年4月15日 16:28Mike Walsh MVPMVP, 版主用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    There's a Workflow forum.

    I'm moving it there. This isn't in any case a programming question (so even Admin would be better - wrong, but better)
  • 2008年4月16日 3:06aifong 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    Hi Brian

     

    To allow Approvers to be able to see draft versions, give them Edit Items access. That way, they will be able to see whatever the Contributers see so they will be able to review.

     

    AF

     

     

     

  • 2008年4月16日 6:23Brian Halkjær 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
     Mike Walsh MVP wrote:
    There's a Workflow forum.

    I'm moving it there. This isn't in any case a programming question (so even Admin would be better - wrong, but better)

     

    I'm not sure if I should mark this as a partial answer or not :-)

     

    Finally, someone form Microsoft actually notices this post...thats a step forward. And since what I am doing is trying to hide a default menu item "Approve/reject" which leads to the _layouts/approve.aspx page, which has nothing to do with workflows, I thought this was a development challenge, which could perhaps be solved through the use of features or the object model? What do I know, thats why I posted the question in the first place. But at least that question is answered now - it cannot be solved that way, as this isn't in any case a programming question. I am now pointet in the direction of workflows - not sure I will spend a whole lot of time looking for answers there though.

     

    Sorry - a little stomach acid. It's just that I have posted several questions about SharePoint development due to a lot of problems during a recent/current critical problem. And since we are only registered members of the ISV Empower program, our questions to MS are answered with....Silence! That be in newsgroups or via our partnership contact. So I guess I got a bit dissapointed when the first response from MS was this. How about some answers instead.

     

    Ahh..feel much better now I got that off my chest. You can now ignore this, and I will try to find answers on my own.

  • 2008年4月16日 6:40Brian Halkjær 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

     

    This can be true, depending on the settings for draft visibility. It can be visible to all contributers or to the author and the approvers. The latter approach is what our client want, because there will be a lot of contributors, and they should only see their own drafts. For all other documents they should see the published version.
  • 2008年4月16日 6:51Brian Halkjær 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    Hi

     

    Actually, the Approve/Reject button is not in the list toolbar, but in the toolbar on the display and edit forms. But this gives me an idea, as I might be able to do something similar in that context.

    For now, we just redirect to a workflow page to tell the user that in this scenario, we want them to use a workflow for approval, and our client is fine with this approach. But if I get a bit of time on my hands to look into this again, I will give it another try based on the concept of the toolbar manager.

     

  • 2009年6月6日 18:49Swizzmagik 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     包含代码
    This works to:

    1.) Enable AJAX on your SharePoint system.
    2.) Load jQuery javascript library into one of your document libraries
    3.) Stick some code into your page to hide the Approve/Reject options:

    <script type="text/javascript" src="/code/jquery-1.3.2.min.js"></script>
    <script language="javascript">
    $("a[href*='approve.aspx']").parents("td#_spFocusHere").hide().next("td.ms-separator").hide()
    </script>
    This works on the DispForm.aspx, I am still searching on how to apply the same logic to hide the option on the drop down associated with each item.

    Hope this helps.

    </John>
  • 2009年7月2日 14:28Korsakov Nikolay 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    This is solution for edit menu.
    http://msdn.microsoft.com/en-us/library/cc768565.aspx
    or this
    http://msdn.microsoft.com/en-us/library/bb418731.aspx