Workflow, Collaboration, Enterprise Content Management

New PowerShell Script Simplifies Content Migration into SharePoint 2007 and 2010

by john holliday 15. December 2009 10:43

Mattias Wollnik from Microsoft has created a nifty PowerShell script that makes it much easier to move content from file shares into SharePoint 2007 and SharePoint 2010 beta sites.   The FCI SharePoint Uploadscript is based on the File Classification Infrastructure(FCI) provided by Windows Server 2008 R2.  The FCI allows administrators to setup policies that control the metadata associated with individual files.  Using Mattias’ script, you can upload files and it will automatically set any matching metadata properties that are present in the target document library.

This is similar to the way that properties are promoted for Office 2007 documents, except that the script works for any file type.  The File Classification Infrastructure provides a snap-in that lets you setup custom file management tasks.  To use the script, you setup a new task that invokes PowerShell with the appropriate parameters.

For example, to upload files to a document library called “Company Files” in the Litware demo portal, you would specify an action type of “Custom” with the executable set to “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” and the arguments set to the following:

-noninteractive file c:\scripts\FciSharePointUpload.ps1 –file “[Source File Path]” –url “http://litwareinc.com” –libPath “Company Files” –sourceAction url –user litwareinc\administrator –password pass@word1

The “[Source File Path]” string tells FCI to substitute the actual file path when the source files are processed.  One cool feature is the ability to upload files directly to a SharePoint 2010 Records Center site, specifying the target content type on the command line.  Using this feature, if any Content Organizer rules exist for the specified content type, they will be applied and processed automatically.

To do this, simply include the –useOfficialFileWebService parameter and then specify the content type using the –contentType parameter instead of -libPath, as in the following example:

-noninteractive file c:\scripts\FciSharePointUpload.ps1 –useOfficialFileWebService file “[Source File Path]” –url “http://litwareinc.com” –contentType “My Content Type” –sourceAction url –user litwareinc\administrator –password pass@word1

To learn more about the script with examples and a complete source code listing, visit http://gallery.technet.microsoft.com/ScriptCenter/en-us/f538c34c-4f74-4645-9649-fd25e49805d6.

Comments

12/15/2009 3:51:52 PM

pingback

Pingback from topsy.com

Twitter Trackbacks for

John Holliday, MVP Office SharePoint Server 2007
[johnholliday.net]
on Topsy.com

topsy.com

Comments are closed
Twitter Facebook Linked-In Subscribe

Pro SharePoint 2007 Development  Pro SharePoint 2007 Records Management Development  6 Office Business Applications for SharePoint 2007

CAML.NET

SharePointPro 2010 SummitSharePoint Evolutions 2010


SharePoint Job Tweets



SPDEVNET

Developer Resources

  • Fields WSS XSLT - Custom XSLT stylesheet that displays the default SharePoint column definitions in a table.
  • Custom Action Identifiers - A sortable table of default field definitions, including CAML declarations for writing content types.
  • CAML.NET Documentation - Online documentation for the CAML.NET class library.