0

I am trying to move a folder from a network location to a SharePoint site that I also have mapped as network folder using a vb script. The SharePoint site prompts for active directory credentials upon opening the network folder. I would also like to replace any existing folders on the SharePoint folder with the same name. Here is what I have so far:

dim filesys
persistent = false
set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "S:", "\\<sharepoint site>", persistent, "username ", "password"


set filesys=CreateObject("Scripting.FileSystemObject") 
filesys.MoveFolder "C:\Documents\TestFolder", "S:\New Folder\"

When I try to run this, I get an error message stating "the local device name has a remembered connection to another network resource." Do I need to map the network connection each time the code is run? Any assistance is appreciated. Thanks!

P5C768
  • 152
  • 10

1 Answers1

0

This is as designed to drop idle connection to the server.

I use something similar as mentioned in this answer here

Map the connection by mapping network drive, copy the files, drop the connection.

Community
  • 1
  • 1
vins
  • 15,030
  • 3
  • 36
  • 47