Do you SharePoint?

Let's talk about it.
posts - 19, comments - 8, trackbacks - 0

October 2009 Entries

Dealing with SPListItemVersion and his cousin SPFileVersion during SPFile or SPListItem copying

Since I spent so many hours on this, I figured I'll post this to remember... When copying SPFiles from one doc library to another, a few things to keep in mind: SPFileVersion will not let you get a reference to the SPFile (per MSDN) so don't do this: SPWeb.GetFile(SPFileVersion.Url) because SPFile.Item will be null SPFileVersionCollection (SPFile.Versions) is not in sync with SPListItemVersionCollection. SPFile.Versions actually does NOT return the current version.  So, iterate through all SPFileVersions and use SPFile.Versions.GetVersionFromLabel(SPListItemVersion.VersionLabel) To keep the check in comments with each version, use the following method to add...

posted @ Saturday, October 03, 2009 11:23 AM | Feedback (0) | Filed Under [ Development WSS 3.0 MOSS 2007 ]

Powered by: