Tuesday, July 26, 2011

SharePoint Workspace, Property name invalid

I had a number of users receiving a "Property name invalid" error when trying to sync to a SharePoint site in SharePoint Workspace. After numerous attempts at resolving the issue by running repair, un-install and reinstall with no success, I did some more research around the error message and found it was most likely a result of the XML parsing. After some further monitoring and log surfing i came up with the following solution.




  1. Select Start > Run


  2. Type “cmd” and select run


  3. Run the following commands


  4. Regsvr32 c:\windows\system32\msxml3.dll


  5. Regsvr32 c:\windows\system32\msxml6.dll


  6. Restart the computer


The users were all running Windows XP, Office 2007 and SharePoint Workspace 2010

Friday, July 8, 2011

PowerShell to Migrate Files from the File System to a SharePoint Document Library

I had the requirement to copy all files and folders from a fileshare directly into SharePoint. Normally i would have just used explorer view however the terminal server that was being used didn't have the web client installed. I used the following poweshell to get the documents migrated
NOTE: this does not migrate security
NOTE: does not check for invalid charcters
NOTE: must be run on a sharepoint server joined to the farm


function ProcessDirectory($directory, $spfolder){
$directory.GetDirectories() foreach{
#create direcotry
write-host "creating directory" $_.Name
$newfolder = $spfolder.SubFolders.Add($_.Name)
#recurse directory
ProcessDirectory $_ $newfolder
}
$directory.GetFiles() foreach{
#uploadfile
write-host "uploading file" $_.Name
$newfile = $spfolder.Files.Add($_.Name,$_.OpenRead(),$true)
}
}
#you could use a local drive. If migrating from a remote server mount the share
#net use X: \\fileshare\sharename
#change current directory
x:
#get web
$web = get-spweb "http://companyweb"
#get the document library
$list = $web.Lists["TestMigration"]
$rootfolder = $list.RootFolder
#get DirectoryInfo object
$currentfolder = get-item .
#start process
ProcessDirectory $currentfolder $rootfolder