using System; |
02 | using System.Collections.Generic; |
03 | using System.Linq; |
04 | using System.Text; |
05 | using Microsoft.SharePoint; |
06 | namespace CopyTo |
07 | { |
08 | class Program |
09 | { |
10 | static void Main( string [] args) |
11 | { |
12 | using (SPSite site = new SPSite( "http://serverName:1111/SitePages/Home.aspx" )) |
13 | { |
14 | using (SPWeb web = site.RootWeb) |
15 | { |
16 | SPFileCollection collFile = web.GetFolder( "Shared Documents" ).Files; |
17 | foreach (SPFile file in collFile) |
18 | { |
19 | file.CopyTo( "Destination Library/" +file.Name, true ); |
20 | Console.WriteLine(file.Name + " is copied successfully" ); |
21 | } |
22 | } |
23 | Console.ReadLine(); |
24 | } |
25 | } |
26 | } |
27 | } |
Comments
Post a Comment