sharepoint2007的功能之强大,大家有目共睹。但其自身总会存在一些瑕疵.许多人在抱怨产品组怎么不一起开发个修改密码的页面呢?其实这些只要我们自己动手就可以轻易的解决了。以下就是本次的Demo.
前期准备:1.去MSDN查看DirectoryEntry,DirectorySearcher相关的属性和方法及使用。
2.新建一个web项目导入Microsoft.sharepoint 以及System.DirectoryServices。
3.打开项目属性,生成后事件:
前期准备:1.去MSDN查看DirectoryEntry,DirectorySearcher相关的属性和方法及使用。
2.新建一个web项目导入Microsoft.sharepoint 以及System.DirectoryServices。
3.打开项目属性,生成后事件:
copy "$(TargetDir)*.dll" C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin
copy "$(ProjectDir)*.ascx" C:\Inetpub\wwwroot\wss\VirtualDirectories\80 \wpresources\changepassword
Demo图片:
Demo代码:
1
using System;
2
using System.Data;
3
using System.Configuration;
4
using System.Collections;
5
using System.Web;
6
using System.Web.Security;
7
using System.Web.UI;
8
using System.Web.UI.WebControls;
9
using System.Web.UI.WebControls.WebParts;
10
using System.Web.UI.HtmlControls;
11
using Microsoft.SharePoint;
12
using System.DirectoryServices;
13
namespace ChangeADPasswordByVan
14
}
2
3
4
5
6
7
8
9
10
11
12
13
14
Demo源码
1
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ChangePassWord.ascx.cs" Inherits="ChangeADPasswordByVan.ChangePassWord" %>
2
<table border="1" cellpadding="0" cellspacing="0" style="width:350px">
3
<tr>
4
<td style="width:138px; height: 30px;">
5
当前用户:</td>
6
<td style="height: 30px; background:#EBF3FF">
7
<asp:Label ID="lb_username" runat="server" Text=""></asp:Label></td>
8
</tr>
9
<tr>
10
<td style="width:138px; height: 30px;">
11
登入名:</td>
12
<td style="height: 30px; background:#EBF3FF">
13
<asp:Label ID="lb_userloginname" runat="server" Text=""></asp:Label></td>
14
</tr>
15
<tr>
16
<td style="width:138px; height: 30px;">
17
旧密码<span style="color: #ff0000">*</span>:</td>
18
<td style="height: 30px; background:#EBF3FF">
19
<asp:TextBox ID="txt_oldpassword" runat="server" TextMode="Password"></asp:TextBox></td>
20
</tr>
21
<tr>
22
<td style="width:138px; height: 30px;">
23
新密码<span style="color: #ff0033">*</span>:</td>
24
<td style="height: 30px; background:#EBF3FF">
25
<asp:TextBox ID="txt_newpasword" runat="server" TextMode="Password"></asp:TextBox></td>
26
</tr>
27
<tr>
28
<td style="width:138px; height: 30px;">
29
再次输入新密码<span style="color: #ff0000">*</span>:</td>
30
<td style="height: 30px; background:#EBF3FF">
31
<asp:TextBox ID="txt_newpassword1" runat="server" TextMode="Password"></asp:TextBox></td>
32
</tr>
33
<tr>
34
<td style="width:100%;"colspan="2">
35
<asp:Button ID="btn_change" runat="server" Text="修改" OnClick="btn_change_Click" />
36
<asp:Button ID="btn_cansle" runat="server" Text="取消" OnClick="btn_cansle_Click" />
37
<asp:Label ID="lb_mesage" runat="server" ForeColor="Red"></asp:Label></td>
38
</tr>
39
</table>
40
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40