开发者

SPListItem.CopyTo method fails when copying to some sub-sites, but not others

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开发者_如何学C 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜