You are viewing limited content. For full access, please sign in.

Question

Question

Saving an Excel file to Shared Drive

asked on October 21, 2019

I have a Forms process that is passing an Excel file to Workflow (FortheUploadedExcelFile_CurrentFile). I also declare two tokens:

So, I'd like to take the uploaded file and save it to the excelFolderPath giving it the name that's in the token for excelFileName.

I tried use the following script  to retrieve the file, and save it as excelFolderPath\excelFileName:

namespace WorkflowActivity.Scripting.WriteExcelFiletonetworkdrive
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;
    using Laserfiche.RepositoryAccess;

    /// <summary>
    /// Provides one or more methods that can be run when the workflow scripting activity is performed.
    /// </summary>
    public class Script1 : RAScriptClass92
    {
        /// <summary>
        /// This method is run when the activity is performed.
        /// </summary>
        protected override void Execute()
        {
            // save Excel file
            System.IO.File.Copy(GetTokenValue("FortheUploadedExcelFile_CurrentFile").ToString(), @"(GetTokenValue("excelFolderPath")" + "\" + "(GetTokenValue("excelFileName")", true);
        }
    }
}

I get an error:  "Newline in constant". Any ideas what I'm doing wrong?

0 0

Replies

replied on October 21, 2019 Show version history

Haven't tested it yet, but I created an "outputFile" token and changed the System.IO.File.Copy line to:

System.IO.File.Copy(GetTokenValue("FortheUploadedExcelFile_CurrentFile").ToString(), @"outputFile", true);

UPDATE:  It didn't like that either. Process terminates with the following message:  "The given path's format is not supported".

0 0
replied on October 22, 2019

You seem to be passing a Workflow file reference to System.IO. You probably want to use the %( FortheUploadedExcelFile _CurrentFile_Path) instead.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.