infopath:隐藏Ribbon菜单 金大昊(jindahao)

需求:

隐藏infopath的Ribbon菜单如下:

解决:

修改FormServer.aspx,管理员可见Ribbon菜单,其他用户隐藏Ribbon菜单。具体修改为黄色部分如下:

<%@ Page 
    inherits="Microsoft.Office.InfoPath.Server.Controls.FormServerPage,Microsoft.Office.InfoPath.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
    EnableSessionState="false"
    AutoEventWireup="false"
    EnableViewState="false"
    LinePragmas="false"
    Language="C#"
    ValidateRequest="false"

%>

<%@ Register Tagprefix="InfoPath" Namespace="Microsoft.Office.InfoPath.Server.Controls" Assembly="Microsoft.Office.InfoPath.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<html>
    <head runat="server">
        <SharePoint:VersionedPlaceHolder UIVersion="4" runat="server">
            <script type="text/javascript">

                var _fV4UI = true;
            </script>        
        </SharePoint:VersionedPlaceHolder>

        <SharePoint:ScriptLink language="javascript" runat="server" UIVersion="4" EnableCustomActions="false" />
                <script type="text/javascript">firstCalled = false;</script>
        <SharePoint:VersionedPlaceHolder UIVersion="4" runat="server">

            <SharePoint:CssLink runat="server"/>

        </SharePoint:VersionedPlaceHolder>

<Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="AddAndCustomizePages">
    <script type="text/javascript">
            document.getElementById("s4-ribbonrow").style.display = "block";
    </script>
</Sharepoint:SPSecurityTrimmedControl>

    </head>

    <body runat="server" id="PageBody">

        <form runat="server" id="HostingForm" method="post" enctype="multipart/form-data" style="100%;">

            <SharePoint:VersionedPlaceHolder UIVersion="4" runat="server">

                <div id="RibbonWrapper" runat="server">
                        <div id="s4-ribbonrow"  class="s4-pr s4-ribbonrowhidetitle" style="display:none">

                                <div id="s4-ribboncont"> 

                                    <SharePoint:SPRibbon 
                                        runat="server" 
                                        PlaceholderElementId="RibbonContainer"
                                        Enabled="false"
                                        Visible="false"
                                        CssFile=""
                                    >
                                        <SharePoint:SPRibbonPeripheralContent
                                            runat="server"
                                            Location="TabRowLeft"
                                            CssClass="s4-trc-container s4-notdlg">
                                            <span style="top:12px;display:inline-block;position:relative;">                                    
                                                <Sharepoint:DeveloperDashboardLauncher
                                                    ID="DeveloperDashboardLauncher"
                                                    NavigateUrl="javascript:ToggleDeveloperDashboard()"
                                                    runat="server"
                                                    ImageUrl="/_layouts/images/DevDashboardOpenandClose16.png"
                                                    Text="<%$Resources:wss,multipages_launchdevdashalt_text%>" />
                                            </span>                                                
                                        </SharePoint:SPRibbonPeripheralContent>
                                    </SharePoint:SPRibbon>
                                </div>
                        </div>
                </div>
                <div id="s4-titlerow" style="display:none"></div>
            </SharePoint:VersionedPlaceHolder>

            <div runat="server">
                <div runat="server">
                    <div runat="server">
                        <InfoPath:XmlFormView id="FormControl" Style="100%;" runat="server"/>                
                        <SharePoint:DeveloperDashboard runat="server" />                                        
                    </div>
                </div>
            </div>
        </form>

    </body>
</html>
原文地址:https://www.cnblogs.com/jindahao/p/2536588.html