Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Copying documents from one library to another library

$
0
0

Hi ,

I have a requirement where i need to copy documents from one server document library to another server document library with meta data attached to it.

Here my i am trying to do by using web services as i cannot write some object model coding due to some deployment issues.I also tried using Vb script here i am able to copy the documents from one library to another library but i need this to happen with meta data.

Vb Script

--------------------

oFSO = CreateObject("Scripting.FileSystemObject")
        sOriginFolder = "\\XXX\sites\xxxx\pmo\Shared Documents"
        NetworkObject = CreateObject("WScript.Network")
        
        sDestinationFolder = "C:\XX\New folder"
        sDestinationSubFolder = "C:\XX\Tools"
        username = ""
        pwd = ""

        ' NetworkObject.RemoveNetworkDrive("W:", True, True)
        NetworkObject.MapNetworkDrive("W:", sOriginFolder, False, username,

pwd)

        For Each sFile In oFSO.GetFolder(sOriginFolder).Files
            If Not oFSO.FileExists(sDestinationFolder & "\" & oFSO.GetFileName

(sFile)) And Not oFSO.FileExists(sDestinationSubFolder & "\" &

oFSO.GetFileName(sFile)) Then
                oFSO.GetFile(sFile).Copy(sDestinationFolder & "\" &

oFSO.GetFileName(sFile), True)
            End If
        Next

        '
        NetworkObject.RemoveNetworkDrive("W:", True, False)
        Dts.TaskResult = ScriptResults.Success
    End Sub
---------------------------

My environment is share point 2007.Is there any way to copy documents.

Thanks in Advance

Bin





Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>