Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

c sharp code to read excel and move files into sharepoint

Posted on 2013-11-06
6
Medium Priority
?
803 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 375 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Loops Section Overview
Screencast - Getting to Know the Pipeline

886 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