复制到某些子站点时 SPListItem.CopyTo 方法失败,但复制到其他子站点时失败
我们开发了一个自定义工作流程,可将页面从顶级站点复制到子站点。页面将复制到子站点页面库内的特定文件夹中。
此工作流已安装在 3 个网站集中,并且在其中 2 个网站集中运行没有任何问题。在第三个网站集中,我们获得了混合结果,其中页面已成功复制到某些子网站,但没有复制到其他子网站。
在 SPListItem.CopyTo 方法调用的深处会引发异常。调用堆栈如下:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
at Microsoft.SharePoint.SPCopy.CopyIntoItem(String srcUrl, SPListItem target, Hashtable props, Byte[] stream, Boolean saveStream)
at Microsoft.SharePoint.SPCopy.CopyIntoNewItem(Hashtable props, Byte[] stream, SPFolder targetFolder, String targetUrl, String srcUrl)
at Microsoft.SharePoint.SPCopy.CopyIntoNewItem(SPListItem src, SPFolder targetFolder, String targetUrl)
at Microsoft.SharePoint.SPCopy.CopyIntoItem(SPListItem src, String targetUrl)
工作流代码确保在执行复制操作之前将原始页面的关联内容类型附加到目标页面库。使用 Reflector 时,似乎有许多 ArrayList 对象用于复制原始页面的属性;这似乎就是问题的根源。
麻烦的子站点中的页面库的配置与成功复制页面的页面库没有任何不同。
它尝试复制到的文件夹由工作流创建为目标页面库根文件夹的子文件夹。它使用默认的文件夹内容类型。
在以前版本的工作流中,代码将页面复制到页面库的根文件夹中,并且没有遇到此问题。我们在此版本中使用文件夹将独特的安全设置应用于该文件夹内的页面。
发布功能已在整个网站集范围内激活,我们使用的平台是 MOSS 2007。
对此的任何想法将不胜感激。
提前致谢。
A custom workflow has been developed that copies pages from a top-level site to sub-sites. The pages are copied into a specific folder within the Pages Library of the sub-sites.
This workflow has been installed in 3 site collections and it works without any problems in 2 of these. In the third site collection, we achieve mixed results where the pages are copied successfully to some sub-sites, but not to others.
An exception is raised a few levels deep within the SPListItem.CopyTo method call. The call stack is as follows:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
at Microsoft.SharePoint.SPCopy.CopyIntoItem(String srcUrl, SPListItem target, Hashtable props, Byte[] stream, Boolean saveStream)
at Microsoft.SharePoint.SPCopy.CopyIntoNewItem(Hashtable props, Byte[] stream, SPFolder targetFolder, String targetUrl, String srcUrl)
at Microsoft.SharePoint.SPCopy.CopyIntoNewItem(SPListItem src, SPFolder targetFolder, String targetUrl)
at Microsoft.SharePoint.SPCopy.CopyIntoItem(SPListItem src, String targetUrl)
The workflow code ensures the associated content type of the original page is attached to the destination Pages Library prior to executing the copy operation. Upon using Reflector, it appears many ArrayList objects are used to copy the properties of the original page across; this is where the problem seems to be stemming from.
The Pages Library within the troublesome sub-sites don’t appear any different in their configuration to the ones where the pages are copied successfully.
The folder it tries to copy to is created by the workflow as a subfolder of the root folder of the destination Pages Library. It uses the default Folder content type.
In a previous version of the workflow, the code copied the pages into the root folder of the Pages Library and did not encounter this issue. We are using folders in this version to apply unique security settings to pages within that folder.
Publishing features have been activated site-collection wide and the platform we are using is MOSS 2007.
Any thoughts on this would be greatly appreciated.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的第一反应是检查权限,检查任何不工作的子站点是否具有与正在工作的子站点相同的权限。
my first instinct would be to check permissions, check that any of the sub sites that aren't working have the same permissions as those that are working.