在SharePoint中对文档库(列表)进行的一些操作

None.gif 以下是我在开发SharePoint过程中写的对文档库和列表进行的一些基本操作,先写下来,日后在加。 using  System;
None.gif
using  System.Data;
None.gif
using  System.Configuration;
None.gif
using  System.Collections;
None.gif
using  System.Web;
None.gif
using  System.Web.Security;
None.gif
using  System.Web.UI;
None.gif
using  System.Web.UI.WebControls;
None.gif
using  System.Web.UI.WebControls.WebParts;
None.gif
using  System.Web.UI.HtmlControls;
None.gif
None.gif
using  System.Data.SqlClient;
None.gif
using  System.IO;
None.gif
using  Microsoft.SharePoint;
None.gif
using  yesinda.yesindakms.sharepoint;
None.gif
using  yesinda.yesindakms.sharepoint.List;
None.gif
using  Microsoft.SharePoint.WebControls;
None.gif
using  Microsoft.SharePoint.Utilities;
None.gif
None.gif
public  partial  class  usercontrol_CreateNewDoc : System.Web.UI.UserControl
ExpandedBlockStart.gifContractedBlock.gifdot.gif
dot.gif {
ContractedSubBlock.gifExpandedSubBlockStart.gif    定义变量和属性
定义变量和属性#region  定义变量和属性
InBlock.gif    
private SPList list9;
InBlock.gif    
private SPListItemCollection items;
InBlock.gif    
public string Url = String.Empty; //保存文档库根文件夹路径
InBlock.gif
    public string HostName = String.Empty; //存放主机名
InBlock.gif

InBlock.gif    
private string siteUrl = "/dept/gsb/";
InBlock.gif    
public string SiteUrl
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
get dot.gifdot.gifreturn this.siteUrl; }
ExpandedSubBlockStart.gifContractedSubBlock.gif        
set dot.gifdot.gif{ siteUrl = value; }
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

InBlock.gif
InBlock.gif    
protected void Page_Load(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
if (!IsPostBack)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            
//绑定DropDownList控件
InBlock.gif
            BindControl();
InBlock.gif            
//绑定TreeView控件
InBlock.gif
            TreeViewBind(this.TreeView1);
InBlock.gif            TreeViewBind(
this.TreeView2);
InBlock.gif            
//AddUserTreeNode(this.TreeView3);
InBlock.gif            
//绑定GridView数据控件
InBlock.gif
            BindGrid();
InBlock.gif
InBlock.gif            HostName 
= Request.UserHostName;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif    为TreeView添加节点
为TreeView添加节点#region  为TreeView添加节点
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 为TreeView添加节点
InBlock.gif    
/// </summary>
InBlock.gif    
/// <param name="parentFolder"></param>
ExpandedSubBlockEnd.gif    
/// <param name="parentNode"></param>

InBlock.gif    private void AddChild(SPFolder parentFolder, TreeNode parentNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
if (parentFolder.SubFolders.Count == 0)
InBlock.gif            
return;
InBlock.gif        
foreach (SPFolder f in parentFolder.SubFolders)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            
if (f.Name != "Forms" && f.Name.IndexOf("_"!= 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                TreeNode child 
= new TreeNode(f.Name, f.ServerRelativeUrl);
InBlock.gif                parentNode.ChildNodes.Add(child);
InBlock.gif                AddChild(f, child);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif    绑定TreeView控件
绑定TreeView控件#region  绑定TreeView控件
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 绑定TreeView控件
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    protected void TreeViewBind(TreeView treeview)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWeb spw 
= sps.OpenWeb();
InBlock.gif        spw.AllowUnsafeUpdates 
= true;
InBlock.gif
InBlock.gif        SPWebCollection sites 
= sps.AllWebs;
InBlock.gif        
foreach (SPWeb site in sites)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            SPListCollection lists 
= site.Lists;
InBlock.gif            
foreach (SPList list in lists)
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                
if (list.BaseType == SPBaseType.DocumentLibrary && list.BaseTemplate != SPListTemplateType.ListTemplateCatalog
InBlock.gif                    
&& list.BaseTemplate == SPListTemplateType.DocumentLibrary)
ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif
dot.gif{
InBlock.gif                    list9 
= spw.Lists[list.Title];
InBlock.gif                    items 
= list9.Items;
InBlock.gif                    SPFolder root 
= list.RootFolder;
InBlock.gif                    TreeNode rootNode 
= new TreeNode(list.Title, root.Url);
InBlock.gif                    treeview.Nodes.Add(rootNode);
InBlock.gif                    AddChild(root, rootNode);
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif    创建数据源
创建数据源#region  创建数据源
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 创建数据源
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    ICollection CreateDataSource()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        DataTable dt 
= new DataTable("mytable");  //创建一个名为mytable的DataTable对象形
InBlock.gif
        DataColumn dc = new DataColumn();         //创建一个列对象
InBlock.gif
        dc.DataType = System.Type.GetType("System.String");  //指定该列的数据类型
InBlock.gif
        dc.Caption = "DocID";                     //设置列的标题
InBlock.gif
        dc.ColumnName = "文档库ID";       //设置 列集合对象中的列的名称,datagrid中显示该列名.
InBlock.gif
        dt.Columns.Add(dc);              //将该列对象加入到表mytable的列集合中
InBlock.gif        
//普通列
InBlock.gif
        DataColumn dc1 = new DataColumn();
InBlock.gif        dc1.DataType 
= System.Type.GetType("System.String");
InBlock.gif        dc1.AllowDBNull 
= false;
InBlock.gif        dc1.Caption 
= "Path";
InBlock.gif        dc1.ColumnName 
= "路径";
InBlock.gif        dt.Columns.Add(dc1);
InBlock.gif
InBlock.gif        DataColumn dc2 
= new DataColumn();
InBlock.gif        dc2.DataType 
= System.Type.GetType("System.String");
InBlock.gif        dc2.AllowDBNull 
= false;
InBlock.gif        dc2.Caption 
= "FullPath";
InBlock.gif        dc2.ColumnName 
= "完整路径";
InBlock.gif        dc2.DefaultValue 
= 25;
InBlock.gif        dt.Columns.Add(dc2);
InBlock.gif
InBlock.gif        SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWeb spw 
= sps.OpenWeb();
InBlock.gif        spw.AllowUnsafeUpdates 
= true;
InBlock.gif
InBlock.gif        SPWebCollection sites 
= sps.AllWebs;
InBlock.gif        
foreach (SPWeb site in sites)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            SPListCollection lists 
= site.Lists;
InBlock.gif            
foreach (SPList list in lists)
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                
if (list.BaseType == SPBaseType.DocumentLibrary && list.BaseTemplate != SPListTemplateType.ListTemplateCatalog
InBlock.gif                    
&& list.BaseTemplate== SPListTemplateType.DocumentLibrary)
ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif
dot.gif{
InBlock.gif                    
if (dt != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    dot.gif
dot.gif{
InBlock.gif                        DataRow dr 
= dt.NewRow();
InBlock.gif                        dr[
0= list.Title;
InBlock.gif                        dr[
1= list.RootFolder.ServerRelativeUrl;
InBlock.gif                        dr[
2= "http://" + sps.HostName + list.RootFolder.ServerRelativeUrl;
InBlock.gif                        dt.Rows.Add(dr);
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        DataView dv 
= new DataView(dt);
InBlock.gif        
return dv;
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 根据路径,动态创建数据源
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    ICollection CreateDataSource(string folderpath)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        DataTable dt 
= new DataTable("mytable");  //创建一个名为mytable的DataTable对象形
InBlock.gif
        DataColumn dc = new DataColumn();         //创建一个列对象
InBlock.gif
        dc.DataType = System.Type.GetType("System.Int32");  //指定该列的数据类型
InBlock.gif
        dc.AutoIncrement = true;              //该列为自动增涨列
InBlock.gif
        dc.AutoIncrementSeed = 1;          //初始值
InBlock.gif
        dc.AutoIncrementStep = 2;          //增量
InBlock.gif
        dc.Caption = "DocID";                     //设置列的标题
InBlock.gif
        dc.ColumnName = "文档库ID";       //设置 列集合对象中的列的名称,datagrid中显示该列名.
InBlock.gif
        dt.Columns.Add(dc);              //将该列对象加入到表mytable的列集合中
InBlock.gif        
//普通列
InBlock.gif
        DataColumn dc1 = new DataColumn();
InBlock.gif        dc1.DataType 
= System.Type.GetType("System.String");
InBlock.gif        dc1.AllowDBNull 
= false;
InBlock.gif        dc1.Caption 
= "Path";
InBlock.gif        dc1.ColumnName 
= "路径";
InBlock.gif        dt.Columns.Add(dc1);
InBlock.gif
InBlock.gif        DataColumn dc2 
= new DataColumn();
InBlock.gif        dc2.DataType 
= System.Type.GetType("System.String");
InBlock.gif        dc2.AllowDBNull 
= false;
InBlock.gif        dc2.Caption 
= "FullPath";
InBlock.gif        dc2.ColumnName 
= "完整路径";
InBlock.gif        dc2.DefaultValue 
= 25;
InBlock.gif        dt.Columns.Add(dc2);
InBlock.gif
InBlock.gif        SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWeb spw 
= sps.OpenWeb();
InBlock.gif        spw.AllowUnsafeUpdates 
= true;
InBlock.gif
InBlock.gif        SPFolder f 
= spw.GetFolder(folderpath);
InBlock.gif
InBlock.gif        
foreach (SPFile file in f.Files)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            
if (dt != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                DataRow dr 
= dt.NewRow();
InBlock.gif                dr[
0= file.Item.ID;
InBlock.gif                dr[
1= file.ServerRelativeUrl;
InBlock.gif                dr[
2= "http://" + sps.HostName + file.ServerRelativeUrl;
InBlock.gif                dt.Rows.Add(dr);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        DataView dv 
= new DataView(dt);
InBlock.gif        
return dv;
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
///读取所有为文档库类型的列表,创建数据源
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    ICollection MyDataSource()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        DataTable dt 
= new DataTable("mytable");  //创建一个名为mytable的DataTable对象形
InBlock.gif
        DataColumn dc = new DataColumn();         //创建一个列对象
InBlock.gif
        dc.DataType = System.Type.GetType("System.Int32");  //指定该列的数据类型
InBlock.gif
        dc.AutoIncrement = true;              //该列为自动增涨列
InBlock.gif
        dc.AutoIncrementSeed = 1;          //初始值
InBlock.gif
        dc.AutoIncrementStep = 2;          //增量
InBlock.gif
        dc.Caption = "DocID";                     //设置列的标题
InBlock.gif
        dc.ColumnName = "文档库ID";       //设置 列集合对象中的列的名称,datagrid中显示该列名.
InBlock.gif
        dt.Columns.Add(dc);              //将该列对象加入到表mytable的列集合中
InBlock.gif        
//普通列
InBlock.gif
        DataColumn dc1 = new DataColumn();
InBlock.gif        dc1.DataType 
= System.Type.GetType("System.String");
InBlock.gif        dc1.AllowDBNull 
= false;
InBlock.gif        dc1.Caption 
= "Path";
InBlock.gif        dc1.ColumnName 
= "路径";
InBlock.gif        dt.Columns.Add(dc1);
InBlock.gif
InBlock.gif        DataColumn dc2 
= new DataColumn();
InBlock.gif        dc2.DataType 
= System.Type.GetType("System.String");
InBlock.gif        dc2.AllowDBNull 
= false;
InBlock.gif        dc2.Caption 
= "FullPath";
InBlock.gif        dc2.ColumnName 
= "完整路径";
InBlock.gif        dc2.DefaultValue 
= 25;
InBlock.gif        dt.Columns.Add(dc2);
InBlock.gif
InBlock.gif        SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWebCollection sites 
= sps.AllWebs;
InBlock.gif
InBlock.gif        
foreach (SPWeb site in sites)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            SPListCollection lists 
= site.Lists;
InBlock.gif
InBlock.gif            
foreach (SPList list in lists)
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                
if (list.BaseType == SPBaseType.DocumentLibrary && list.BaseTemplate != SPListTemplateType.ListTemplateCatalog
InBlock.gif                    
&& list.BaseTemplate == SPListTemplateType.DocumentLibrary)
ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif
dot.gif{
InBlock.gif                    SPDocumentLibrary docLibrary 
= (SPDocumentLibrary)list;
InBlock.gif
InBlock.gif                    
if (!docLibrary.IsCatalog && list.BaseTemplate !=
InBlock.gif                        SPListTemplateType.XMLForm)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    dot.gif
dot.gif{
InBlock.gif                        SPListItemCollection docLibItems 
= docLibrary.Items;
InBlock.gif                        
foreach (SPListItem docLibItem in docLibItems)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        dot.gif
dot.gif{
InBlock.gif                            
if (dt != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                            dot.gif
dot.gif{
InBlock.gif                                DataRow dr 
= dt.NewRow();
InBlock.gif                                dr[
0= docLibItem.ID ;
InBlock.gif                                dr[
1= docLibItem.Url;
InBlock.gif                                dr[
2= "http://" + sps.HostName + docLibItem.File.ServerRelativeUrl;
InBlock.gif                                dt.Rows.Add(dr);
ExpandedSubBlockEnd.gif                            }

ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        DataView dv 
= new DataView(dt);
InBlock.gif        
return dv;
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif    绑定控件
绑定控件#region  绑定控件
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 绑定DropDownList控件
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    protected void BindControl()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
this.ddlDocTitle1.DataSource = CreateDataSource();
InBlock.gif        
this.ddlDocTitle1.DataTextField = "文档库ID";
InBlock.gif        
this.ddlDocTitle1.DataValueField = "路径";
InBlock.gif        
this.ddlDocTitle1.DataBind();
InBlock.gif
InBlock.gif        
this.ddlDocTitle2.DataSource = CreateDataSource();
InBlock.gif        
this.ddlDocTitle2.DataTextField = "文档库ID";
InBlock.gif        
this.ddlDocTitle2.DataValueField = "路径";
InBlock.gif        
this.ddlDocTitle2.DataBind();
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 绑定GridView控件
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    protected void BindGrid()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
if (ViewState["FromPath"!= null)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
this.GridView1.DataKeyNames = new string[] dot.gifdot.gif"文档库ID" };
InBlock.gif            
this.GridView1.DataSource = CreateDataSource(ViewState["FromPath"].ToString());
InBlock.gif            
this.GridView1.DataBind();
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
this.GridView2.DataKeyNames = new string[] dot.gifdot.gif"文档库ID" };
InBlock.gif        
this.GridView2.DataSource = MyDataSource();
InBlock.gif        
this.GridView2.DataBind();
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 显示系统用户
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <param name="treeview"></param>

InBlock.gif    protected void AddUserTreeNode(TreeView treeview)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWeb spw 
= sps.OpenWeb();
InBlock.gif        spw.AllowUnsafeUpdates 
= true;
InBlock.gif
InBlock.gif
InBlock.gif        SPUserCollection users 
= spw.AllUsers;
InBlock.gif        SPGroupCollection groups 
= spw.Groups;
InBlock.gif
InBlock.gif        
foreach (SPGroup group in groups)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            Response.Write(group.Name 
+ " " + group.ID + "<br>");
ExpandedSubBlockEnd.gif        }

InBlock.gif        
foreach (SPUser user in users)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            Response.Write(user.Name 
+ " " + user.ID + "<br>");
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif    发送文档
发送文档#region  发送文档
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 发送文档
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    protected void SendDocument()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWeb spw 
= sps.OpenWeb();
InBlock.gif        spw.AllowUnsafeUpdates 
= true;
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        将指定的文档发送到指定的文档库
将指定的文档发送到指定的文档库#region 将指定的文档发送到指定的文档库
InBlock.gif        ArrayList arylst 
= new ArrayList();
InBlock.gif        
//选择行,获取行中文档的地址
InBlock.gif
        for (int rowindex = 0; rowindex < this.GridView1.Rows.Count; rowindex++)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            
if (((CheckBox)this.GridView1.Rows[rowindex].Cells[0].FindControl("CheckBox1")).Checked == true)
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                arylst.Add(
this.GridView1.Rows[rowindex].Cells[2].Text);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        SPFolder f 
= spw.GetFolder(ViewState["FromPath"].ToString());
InBlock.gif        
for (int j = 0; j < arylst.Count; j++)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            SPFile file 
= f.Files[arylst[j].ToString()];
InBlock.gif            
byte[] bytes = f.Files[file.Name].OpenBinary();
InBlock.gif
InBlock.gif            
//复制文档到指定的文件夹,适合如跨网站复制文件
InBlock.gif
            SPFolder folder = spw.GetFolder(ViewState["ToPath"].ToString()); ;
InBlock.gif            
bool ex = false;
InBlock.gif            
if (folder.Exists)
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif
dot.gif{
InBlock.gif                    ex 
= folder.Files[file.Name].Exists;
InBlock.gif                    Response.Write(
"<script language="javascript">alert('已有相同名称的文件存在');</script>");
InBlock.gif                    
return;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif
dot.gif{
InBlock.gif                    ex 
= false;
InBlock.gif                    folder.Files.Add(file.Name, bytes, 
true);
InBlock.gif                    Response.Write(
"<script language="javascript">alert('上传成功!');</script>");
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        发送前给文档受权
发送前给文档受权#region  发送前给文档受权
InBlock.gif        
//文档受权
ExpandedSubBlockEnd.gif
        #endregion

ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif    权限控制
权限控制#region  权限控制
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 给条目授与多个权限
InBlock.gif    
/// </summary>
InBlock.gif    
/// <param name="itemId"></param>
InBlock.gif    
/// <param name="userOrGroupName"></param>
ExpandedSubBlockEnd.gif    
/// <param name="types"></param>

InBlock.gif    public void AssignRights(int itemId, string userOrGroupName, SPRoleType[] types)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWeb spw 
= sps.OpenWeb();
InBlock.gif        spw.AllowUnsafeUpdates 
= true;
InBlock.gif        SPList list 
= spw.Lists["文档模板"];
InBlock.gif
InBlock.gif        
//取得定义的ID
InBlock.gif
        SPListItem item = list.GetItemById(itemId);
InBlock.gif        
//新的权限集合
InBlock.gif
        SPRoleAssignment nrole = new SPRoleAssignment(list.ParentWeb.AllUsers[userOrGroupName]);
InBlock.gif        
//清空列表项原有权限
InBlock.gif
        nrole.RoleDefinitionBindings.RemoveAll();
InBlock.gif        
//取得站点的权限定义
InBlock.gif
        SPRoleDefinitionCollection roleDefinitions = list.ParentWeb.RoleDefinitions;
InBlock.gif        
foreach (SPRoleType type in types)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            SPRoleDefinition rdnew 
= roleDefinitions.GetByType(type);
InBlock.gif            
//绑定权限定义
InBlock.gif
            nrole.RoleDefinitionBindings.Add(rdnew);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
//添加角色
InBlock.gif
        if (!item.HasUniqueRoleAssignments)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            item.BreakRoleInheritance(
true);
ExpandedSubBlockEnd.gif        }

InBlock.gif        item.RoleAssignments.Add(nrole);
InBlock.gif
InBlock.gif        item.Update();
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 给条目授与一个权限
InBlock.gif    
/// </summary>
InBlock.gif    
/// <param name="itemId"></param>
InBlock.gif    
/// <param name="userOrGroupName"></param>
ExpandedSubBlockEnd.gif    
/// <param name="types"></param>

InBlock.gif    public void AssignRight(int itemId, string userOrGroupName, SPRoleType type)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWeb spw 
= sps.OpenWeb();
InBlock.gif        spw.AllowUnsafeUpdates 
= true;
InBlock.gif        SPList list 
= spw.Lists["文档模板"];
InBlock.gif
InBlock.gif        
//取得定义的ID
InBlock.gif
        SPListItem item = list.GetItemById(itemId);
InBlock.gif        
//新的权限集合
InBlock.gif
        SPRoleAssignment nrole = new SPRoleAssignment(list.ParentWeb.AllUsers[userOrGroupName]);
InBlock.gif        
//清空列表项原有权限
InBlock.gif        
//nrole.RoleDefinitionBindings.RemoveAll();
InBlock.gif        
//取得站点的权限定义
InBlock.gif
        SPRoleDefinitionCollection roleDefinitions = list.ParentWeb.RoleDefinitions;
InBlock.gif        SPRoleDefinition rdnew 
= roleDefinitions.GetByType(type);
InBlock.gif        
//绑定权限定义
InBlock.gif
        nrole.RoleDefinitionBindings.Add(rdnew);
InBlock.gif        
//添加角色
InBlock.gif
        if (!item.HasUniqueRoleAssignments)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            item.BreakRoleInheritance(
true);
ExpandedSubBlockEnd.gif        }

InBlock.gif        item.RoleAssignments.Add(nrole);
InBlock.gif
InBlock.gif        item.Update();
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif    上传文档
上传文档#region  上传文档
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 上传文档到文档库
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <param name="filename"></param>

InBlock.gif    protected void UpLoadDocument()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
//上传附件添加到文档库,并返回ID,赋给model.Mattachment
InBlock.gif
        string filename = FileUpload1.PostedFile.FileName.Substring(FileUpload1.PostedFile.FileName.LastIndexOf("\"+ 1);
InBlock.gif        Stream filedataStream 
= FileUpload1.PostedFile.InputStream;
InBlock.gif        
int dataLen = FileUpload1.PostedFile.ContentLength;
InBlock.gif        
string fileType = FileUpload1.PostedFile.ContentType;
InBlock.gif        
byte[] fileData = new byte[dataLen];
InBlock.gif        filedataStream.Read(fileData, 
0, dataLen);
InBlock.gif
InBlock.gif        SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWeb spw 
= sps.OpenWeb();
InBlock.gif        spw.AllowUnsafeUpdates 
= true;
InBlock.gif        SPList list 
= spw.Lists[this.ddlDocTitle1.SelectedItem.Text];
InBlock.gif
InBlock.gif        SPFolder folder 
= list.RootFolder;
InBlock.gif        
bool ex = false;
InBlock.gif        
if (folder.Exists)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                ex 
= folder.Files[filename].Exists;
InBlock.gif                Response.Write(
"<script language="javascript">alert('已有相同名称的文件存在');</script>");
InBlock.gif                
return;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                folder.Files.Add(filename, fileData, 
true);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif    创建文件夹
创建文件夹#region  创建文件夹
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 在指定的文档库中创建文件夹
InBlock.gif    
/// </summary>
InBlock.gif    
/// <param name="folderUrl"></param>
ExpandedSubBlockEnd.gif    
/// <param name="folderName"></param>

InBlock.gif    protected void CreateFolder(string folderUrl,string folderName)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif         SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWeb web 
= sps.OpenWeb();
InBlock.gif        web.AllowUnsafeUpdates 
= true;
InBlock.gif        
InBlock.gif        SPFolder parent 
= web.GetFolder(folderUrl);
InBlock.gif        
if (parent.Exists)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            SPList l 
= web.Lists.GetList(parent.ParentListId, true);
InBlock.gif            SPListItem item 
= l.Folders.Add(folderUrl, SPFileSystemObjectType.Folder);
InBlock.gif            item[
"名称"= "fsfd";
InBlock.gif            item.Update();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 执行文档上传
InBlock.gif    
/// </summary>
InBlock.gif    
/// <param name="sender"></param>
ExpandedSubBlockEnd.gif    
/// <param name="e"></param>

InBlock.gif    protected void Button1_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
if (this.FileUpload1.FileName != "")
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            UpLoadDocument();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 选择文档库的路径
InBlock.gif    
/// </summary>
InBlock.gif    
/// <param name="sender"></param>
ExpandedSubBlockEnd.gif    
/// <param name="e"></param>

InBlock.gif    protected void ddlDocTitle2_SelectedIndexChanged(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        Url 
= this.ddlDocTitle2.SelectedValue;
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 将一个文档库中的文档发送到指定文档库
InBlock.gif    
/// </summary>
InBlock.gif    
/// <param name="sender"></param>
ExpandedSubBlockEnd.gif    
/// <param name="e"></param>

InBlock.gif    protected void btnCopy_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        SendDocument();
ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
//e.Row.Cells[3].Attributes.Add("style", "display:none");
InBlock.gif
        e.Row.Cells[2].Attributes.Add("style""display:none");
ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void Button2_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        ArrayList arylst 
= new ArrayList();
InBlock.gif
InBlock.gif        
for (int i = 0; i < this.CheckBoxList1.Items.Count; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            
if (this.CheckBoxList1.Items[i].Selected)
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                arylst.Add(
this.CheckBoxList1.Items[i].Value);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
//给每个文档库中的一条设置用户权限
ExpandedSubBlockStart.gifContractedSubBlock.gif
        SPRoleType[] types = new SPRoleType[] dot.gifdot.gif{ SPRoleType.Administrator,SPRoleType.Contributor,SPRoleType.Reader,SPRoleType.WebDesigner };
InBlock.gif        
for (int j = 0; j < arylst.Count; j++)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            AssignRight(
9this.txtName.Text.Trim(), types[int.Parse(arylst[j].ToString())]);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        ViewState[
"FromPath"= this.TreeView1.SelectedNode.Value;
InBlock.gif        BindGrid();
ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void TreeView2_SelectedNodeChanged(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        ViewState[
"ToPath"= this.TreeView2.SelectedNode.Value;
ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void TreeView3_SelectedNodeChanged(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
//Session["DocLibName"] = this.TreeView3.SelectedNode.Value;
ExpandedSubBlockEnd.gif
    }

InBlock.gif    
protected void lnkSendMsg_Command(object sender, CommandEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        LinkButton lb 
= (LinkButton)sender;
InBlock.gif        DataControlFieldCell dcf 
= (DataControlFieldCell)lb.Parent;
InBlock.gif        GridViewRow gvr 
= (GridViewRow)dcf.Parent;
InBlock.gif        GridView1.SelectedIndex 
= gvr.RowIndex;
InBlock.gif
InBlock.gif        doAddMessageSendReceive(
301, DateTime.Now,gvr.Cells[2].Text,"301", gvr.Cells[3].Text);
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 新增消息
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    protected void doAddMessageSendReceive(int receiveid,DateTime sendtime,string msgtitle,string to,string content)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        Yesidea.Model.Message_SendList modelMessage_SendList 
= new Yesidea.Model.Message_SendList();
InBlock.gif        Yesidea.BO.Message_SendList boMessage_SendList 
= new Yesidea.BO.Message_SendList();
InBlock.gif
InBlock.gif        modelMessage_SendList.Sender 
= receiveid;
InBlock.gif        modelMessage_SendList.SendTime 
= sendtime;
InBlock.gif        modelMessage_SendList.Title 
= msgtitle;
InBlock.gif        modelMessage_SendList.Ricivers 
= to;
InBlock.gif        modelMessage_SendList.MContent 
= content;
InBlock.gif        modelMessage_SendList.Notes 
= "";
InBlock.gif
InBlock.gif        
string[] arr = null;
InBlock.gif        arr 
= GetSplitString(to, ",");
InBlock.gif
InBlock.gif        boMessage_SendList.AddMessage(modelMessage_SendList, arr);
InBlock.gif        Response.Write(
"<script language='javascript'>alert('发送成功');</script>");
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 拆分字符串成字符串数组
InBlock.gif    
/// </summary>
InBlock.gif    
/// <param name="list"></param>
InBlock.gif    
/// <param name="gap"></param>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    private string[] GetSplitString(string list, string gap)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
char[] delimiter = gap.ToCharArray();
InBlock.gif        
string[] report = null;
InBlock.gif        
for (int i = 1; i <= list.Length; i++)   //把用逗号隔开的字符串拆分成字符串数组report   
ExpandedSubBlockStart.gifContractedSubBlock.gif
        dot.gifdot.gif{
InBlock.gif            report 
= list.Split(delimiter, i);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
return report;
ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
this.GridView2.PageIndex = e.NewPageIndex;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
this.GridView2.DataKeyNames = new string[] dot.gifdot.gif"文档库ID" };
InBlock.gif        
this.GridView2.DataSource = MyDataSource();
InBlock.gif        
this.GridView2.DataBind();
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 选择路径
InBlock.gif    
/// </summary>
InBlock.gif    
/// <param name="sender"></param>
ExpandedSubBlockEnd.gif    
/// <param name="e"></param>

InBlock.gif    protected void ddlDocTitle2_SelectedIndexChanged1(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        Url 
= this.ddlDocTitle2.SelectedItem.Value;
ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
this.GridView1.PageIndex = e.NewPageIndex;
InBlock.gif        
if (ViewState["FromPath"!= null)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
this.GridView1.DataKeyNames = new string[] dot.gifdot.gif"文档库ID" };
InBlock.gif            
this.GridView1.DataSource = CreateDataSource(ViewState["FromPath"].ToString());
InBlock.gif            
this.GridView1.DataBind();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void Button1_ServerClick(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        SPSite sps 
= yesinda.yesindakms.sharepoint.List.ListLib.findParamSite("/dept/gsb/"this.Context);
InBlock.gif        sps.AllowUnsafeUpdates 
= true;
InBlock.gif        SPWeb web 
= sps.OpenWeb();
InBlock.gif        web.AllowUnsafeUpdates 
= true;
InBlock.gif        
InBlock.gif        
// Create folder as subcolumn
InBlock.gif
        string folderUrl = ColumnTreeBox1.CurrentValue.Trim();
InBlock.gif        SPFolder parent 
= web.GetFolder("/dept/gsb/DocLib5/");
InBlock.gif         Label1.Text 
= Label1.Text + parent.Url.ToString() + "<br>";
InBlock.gif        
if (parent.Exists)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            SPList l 
= web.Lists.GetList(parent.ParentListId, true);
InBlock.gif            SPDocumentLibrary doc 
= (SPDocumentLibrary)l;
InBlock.gif            SPListItem item 
= l.Items.Add("/dept/gsb/DocLib5", SPFileSystemObjectType.Folder);
InBlock.gif            Response.Write(siteUrl 
+ folderUrl);
InBlock.gif            item[
"名称"= "fsfd";
InBlock.gif            item.Update();
InBlock.gif            
string parentUrl = parent.Url;
InBlock.gif            
string currentUrl = parentUrl + "/" + name;
InBlock.gif
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                SPList infoList 
= web.Lists["栏目信息表"];
InBlock.gif                SPListItem newItem 
= infoList.Items.Add();
InBlock.gif                newItem[
"全路径"= currentUrl;
InBlock.gif                newItem[
"栏目名"= name;
InBlock.gif                newItem[
"是否顶级"= false;
InBlock.gif                
if (CheckBox2.Checked)
InBlock.gif                    newItem[
"是否汇总"= true;
InBlock.gif                
if (CheckBox3.Checked)
InBlock.gif                    newItem[
"是否审核"= true;
InBlock.gif                
if (!CheckBox4.Checked)
InBlock.gif                    newItem[
"是否显示"= false;
InBlock.gif                
if (CheckBox5.Checked)
InBlock.gif                    newItem[
"URL"= TextBox2.Text;
InBlock.gif                
//以上if语句省去else,因为列表项有默认值
InBlock.gif
                newItem.Update();
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch (Exception ex)
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif
dot.gif{
InBlock.gif                Response.Write(ex.Message);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
None.gif
None.gif
None.gifTrackback: http:
// tb.blog.csdn.net/TrackBack.aspx?PostId=1525216
None.gif

None.gif

转载于:https://www.cnblogs.com/jhobo/archive/2007/06/06/773647.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值