Solved

c sharp code to read excel and move files into sharepoint

Posted on 2013-11-06
6
787 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…

729 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