# Is it possible to add files to a document library or modify metadata from the command prompt?

I have a number of pdf-reports that I would like to upload to a WSS 3.0 document library. The pdf-files are generated by a number of scripts that collect data and compile a report using LaTeX.

I can copy the pdf-files to the SharePoint document library by mapping the document library and using copy

net use x: \\path\to\sharepoint\document\library
copy myfile.pdf x:


where x: is a free drive letter. However, I would like to supply some additional metadata to columns in the document library directly from the script that generate the pdf-file and copies it to the SharePoint document library.

Is it possible to achieve the above using standard Windows command line tools or does a small application exist that I can put on the file server together with the report generating scripts? I don't have rights to install programs on the users PCs.

-
I think my question is a dublicate of this one: <sharepoint.stackexchange.com/questions/17074/…;. Sorry. –  Martin Heller Aug 1 '11 at 11:28
Except for the metadata part. –  Jesus Shelby Aug 1 '11 at 13:40

MS has a few posts that might assist you.

Managing doc libraries with PowerShell http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/23/use-powershell-cmdlets-to-manage-sharepoint-document-libraries.aspx

Pingar, has created an API to work with documents and a script to use with it. I have not looked at it, but it appears to do what you want. http://www.pingar.com/Blog/Posts.aspx?PostID=55

-
Thanks. The PowerShell interface appeals to me. However, I'm not sure I can use it as a normal user with WSS 3.0? I have downloaded and installed PowerShell v2.0 from support.microsoft.com/kb/968929. This site get-spscripts.com/2011/03/… indicates that I should be able to use the SharePoint cmdlets with WSS 3.0 after issuing the command [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint"). However, this does not seem to activate the SP cmdlets? –  Martin Heller Aug 1 '11 at 14:03
local use of powershell wouldn't be an option, as you need to have the sharepoint assemblies locally installed. –  Bas Lijten Aug 1 '11 at 14:20
There are no cmdlets for WSS3/MOSS. Basicly what you are doing is "hooking" into the object model. However the automation guru Gary Lapointe has created custom cmdlets for working with SP as well as extended stsadm commands (which you can script into Powershell for automation purposes): blog.falchionconsulting.com/index.php/category/stsadm-commands/… -- and yes they have to be executed on the server. –  Jesus Shelby Aug 1 '11 at 14:22
Thank you Bas Lijten and Jesus Shelby. It seems that what I want is not possible for non-administrative users. The users that generate the pdf-reports do not have rights to access the stsadm command or to the Microsoft.SharePoint.dll on the server. They can add/remove files from the command line by mapping the document library or add/remove files and change metadata through the Web interface. –  Martin Heller Aug 1 '11 at 14:44

Adding metadata won't be possible with PDF-files using the command-line. You will need to access the webservice to upload the document and provide the metadata. You can create a commandline application that calls the webservice to upload documents and add metadata to the files, when your script executes.

-
Do you have a link to an example of how to do this? Googling for command line and WSS gives me lots of information about administrating a SharePoint site using command line tools. But I can't seem to find information about adding or modifying contents as a normal user. –  Martin Heller Aug 1 '11 at 11:59