几个常用的Webpart类用法

100 篇文章 0 订阅
17 篇文章 0 订阅
1、 获取SPS文档库的数据
 
SPSite site  =  SPControl.GetContextSite(Context);

// 取该虚拟服务器上的根站点

SPWeb web 
=  site.AllWebs[ " / " ];

// 取得Shared Documents这个文档库对象

SPDocumentLibrary docLib 
=  (SPDocumentLibrary)web.Lists[ " Shared Documents " ];

// 获取文档库的数据


SPListItemCollection items 
=  docLib.Items;


foreach  (SPListItem item  in  items)


{

Response.Write(SPEncode.HtmlEncode(item.Xml));


}

 

2、修改AD登录密码

 

 

string  userName  =  SPControl.GetContextWeb(Context).CurrentUser.LoginName;
userName 
=  userName.Remove( 0 , userName.LastIndexOf( ' / ' +   1 );
DirectoryEntry user 
=   new  DirectoryEntry( " WinNT://./ "   +  userName);
try
{
user.Invoke(
" ChangePassword " new   object [] {oldPsw, newPsw} );
}

catch  (Exception ex)
{
output.WriteLine(
" 出错啦 " );
}
;

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值