Solved

c sharp code to read excel and move files into sharepoint

Posted on 2013-11-06
6
772 Views
Last Modified: 2013-12-01
Hi,
 I want to migrate files from file  server to a document Library in SharePoint 2013.
 On a file server say 10 thousand files are there.
 I want to 1st create 8 thousand folders, then inside each folder 1 or max 3 files to be stored.
 I am using 1 Excel sheet for this with 2 columns ,where-
1.Folder Name, 2.Path of files (from which I  migrate files ).
So I will first create a folder for a set of few files then I want files into that folder.
 Any starting code pls
0
Comment
Question by:sharepointDepot
  • 4
  • 2
6 Comments
 
LVL 53

Assisted Solution

by:Will Szymkowski
Will Szymkowski earned 125 total points
ID: 39629376
If you are simply copying files to another location you might want to just use Robocopy...

PAQ - http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Windows_Server_2008/Q_28258952.html

Use this example below...
robocopy source destination /E /ZB /DCOPY:T /COPYALL /R:1 /W:1 /V /TEE /LOG:Robocopy.log

Here's what the switches mean:

•source :: Source Directory (drive:\path or \\server\share\path).
•destination :: Destination Dir (drive:\path or \\server\share\path).
•/E :: copy subdirectories, including Empty ones.
•/ZB :: use restartable mode; if access denied use Backup mode.
•/DCOPY:T :: COPY Directory Timestamps.
•/COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU). Copies the Data, Attributes, Timestamps, Ownser, Permissions and Auditing info
•/R:n :: number of Retries on failed copies: default is 1 million but I set this to only retry once.
•/W:n :: Wait time between retries: default is 30 seconds but I set this to 1 second.
•/V :: produce Verbose output, showing skipped files.
•/TEE :: output to console window, as well as the log file.
•/LOG:file :: output status to LOG file (overwrite existing log).

Reference - http://community.spiceworks.com/topic/278298-move-shared-folders-and-retain-file-and-share-permissions-with-robocopy

Will.
0
 

Author Comment

by:sharepointDepot
ID: 39629892
Hi,
my target location is sharepoint library.
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39630887
That should be fine. You can use the UNC path to the library and transfer the files needed.

Will.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:sharepointDepot
ID: 39631492
Hi,
my files are on folder in document library at url-

 http://intranet.contoso.com/filezz

robocopy \\DEMO2010A\filezz \\intranet.contoso.com\Files /E /ZB /DCOPY:T /COPYALL /R:1 /W:1 /V /TEE /LOG:Robocopy.log

unable to copy files-
1.access denied
2.path incorrect
0
 

Accepted Solution

by:
sharepointDepot earned 0 total points
ID: 39678646
0
 

Author Closing Comment

by:sharepointDepot
ID: 39687901
it helped to make folders
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now