Upload files to SharePoint Library with Scheduled Task
A PowerShell with SharePoint tutorial
SharePoint
has several methods to
upload files from Windows Explorer to a document library,
but if you want to do it automatically, you should use a
PowerShell script.
In such a scenario, you can put all files that should be
uploaded in a specific folder and then they will be uploaded
automatically to the SharePoint library of your choice.
In the
previous
article, Peter Kalmström explainded how to expand the upload
script that he created
earlier,
so that all copied files are moved to a subfolder. That
way, they will not be uploaded to the library again.
In the demo below, Peter will not write new code but instead
explain how to schedule a task that runs the script automatically.
For that, he creates a "script running" task the Task Scheduler,
which is included in Windows.
Note that the SharePoint credentials need to be stored in
Windows Credential Manager if you want to run a PowerShell
script that connects to SharePoint automatically. We have
explained how to do that in an
earlier
article.
In the next article, we will show how metadata can be included
in the uploaded files.
You will find more detailed explanations in
the
book.
|