I have items in a list in a SharePoint 2003 site that I need to add to an existing list in a 2007 site. The items have attachments.
How can this be accomplished using PowerShell or C#?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I ended up using a C# program in conjunction with the SharePoint web services to accomplish this. I also used the extension methods (GetXElement, GetXmlNode) on Eric White’s blog here to convert between XMLNodes and XElements which made the XML from SharePoint easier to work with.
Below is a template for most of the code needed to transfer list data, including attachments, from one SharePoint List (either 2003 or 2007) to another one:
1) This is the code moves attachments after a new item has been added to the target list.
2) Code that iterates through the old SharePoint List and populates the new one.
3) Miscellaneous support code for this sample.