sharepoint默認是沒有修改AD密碼 和切換 用戶的功能,這裡我用future的方式來實現。
部署wsp前:
部署後:
點擊以其他用戶身份登錄
點擊修改用戶密碼:
這裡的擴展才菜單我們用CustomAction來實現,我們需要添加空項目來部署它
以其他用戶身份登錄得xml如下:
修改用戶密碼的xml如下:
這裡我們需要新建一個應用程序頁面,首先需要添加路徑映射:
添加應用程序頁面的代碼如下:
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %><%@ Import Namespace= "Microsoft.SharePoint.ApplicationPages" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChangePassword.aspx.cs" Inherits="SharePointProjectDemo.Layouts.ChangePassword.ChangePassword" DynamicMasterPageFile="~masterurl/default.master" %> <asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server"> </asp:Content><asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server"> <asp:Literal ID="ltMsg" EnableViewState="false" runat="server"></asp:Literal><div> <h3> <span>修改密碼</span> </h3> <table width="400px"> <tr> <td> 域 </td> <td> : </td> <td> <asp:TextBox ID="txtdomain" runat="server" ></asp:TextBox> </td> </tr> <tr> <td> 舊密碼 </td> <td> : </td> <td> <asp:TextBox ID="txtOld" runat="server" TextMode="Password"></asp:TextBox> </td> </tr> <tr> <td> 新密碼 </td> <td> : </td> <td> <asp:TextBox ID="txtPass1" runat="server" TextMode="Password"></asp:TextBox> </td> </tr> <tr> <td> 確認新密碼 </td> <td> : </td> <td> <asp:TextBox ID="txtPass2" runat="server" TextMode="Password"></asp:TextBox> &