adoney

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
在一个infopath的表单库中定义了一个事件,当新加入的表单符合一定条件就将它拷贝到另一网站上的一个表单库上,
拷贝的程序如下:
 
      SPSite site = new SPSite("http://szhgdb1:8888/sites/hr/default.aspx"); 
      SPFileCollection destFiles = site.RootWeb.Folders["test"].Files;
      string destUrl = destFiles.Folder.Url + "/" + file.Name;
      byte [] binFile = file.OpenBinary(); 
      destFiles.Add(destUrl,binFile,true);
 
运行正常,但当表单库的名字不为"",而是中文时,就会产生异常,导致失败,错误提示如下:
 
事件类型: 错误
事件来源: ReportHandler
事件种类: 无
事件 ID: 0
日期:  2006-5-10
事件:  10:51:25
用户:  N/A
计算机: SZHGDB1
描述:
拷贝文件出错!System.ArgumentException: 值不在预期的范围内。
   at Microsoft.SharePoint.SPFolderCollection.get_Item(String urlOfFolder)
   at DocLibEventHandler.DocVersionHandler.Microsoft.SharePoint.IListEventSink.OnEvent(SPListEvent listEvent)
有关更多信息,请参阅在 http://go.microsoft.com/fwlink/events.asp 的帮助和支持中心。
 
posted on 2006-05-12 10:40  Adoney  阅读(505)  评论(3编辑  收藏  举报