SharePoint 2013

Aug 27, 2013 at 1:42 PM
Hi,

Is this tool also compatible with SharePoint 2013?
Coordinator
Aug 27, 2013 at 11:05 PM
I haven't tested it on 2013, but it should work bcos the web services are ~ the same.
Aug 28, 2013 at 7:05 AM
Thanks for the reply.

I'm testing it right now on a SharePoint 2013 environment, but I receive the following error message:
At D:\Install\SPInstall\Solutions\Folders2SP\Folders2SP.ps1:98 char:3
  • return $downloadedFile
  • ~~~~~~~~~~~~~~~~~~~~~~
    Control cannot leave a finally block.
At D:\Install\SPInstall\Solutions\Folders2SP\Folders2SP.ps1:211 char:3
  • return $wsItem
  • ~~~~~~~~~~~~~~
    Control cannot leave a finally block.
    • CategoryInfo : ParserError: (:) [], ParseException
    • FullyQualifiedErrorId : ControlLeavingFinally
Any suggestions to fix this problem?
Coordinator
Aug 29, 2013 at 12:38 AM
Edited Aug 29, 2013 at 12:39 AM
OK I did limited testing on 2013 and the PS script doesn't run with the 2 "finally{}" statements with a "return". I don't know what I was smoking when I wrote f2sp... it's in dire need of "optimization".

Quick fix... just move the return statement outside the finally blocks.

Example:
function spGetFile([string]$url, [string]$file)
{
    $downloadedFile = $null
    try
    {
        $et = measure-command{
            $oWC = new-object system.net.WebClient
            $oWC.credentials = [System.Net.CredentialCache]::DefaultCredentials;
            $oWC.DownloadFile($url, $file);
            $oWC.Dispose();
        }
        $downloadedFile = Get-Item $file
        logIt $log ("`tDownloaded "+ $downloadedFile.Name +", download time: $et.TotalSeconds") yellow
    }
    catch
    {       
        logIt $log ("Exception: "+ $_.Message) red
    }
    return $downloadedFile
} 
Aug 29, 2013 at 7:10 AM
Thanks! I'll pick this up next week!