The given path's format is not supported.
Hi,
I need to read the file names from a remote server in the same network using C# in script task, I have shared the folder for access also. But i get the following error
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotSupportedException: The given path's format is not supported.
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption)
at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
at System.IO.Directory.GetFiles(String path)
at ST_4009fae0ea9649f3a99f97730365dad3.csproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
I have the following code
string[] allFiles = Directory.GetFiles(Dts.Variables["SrcFileLocation"].Value.ToString());
the value of the variable is \\SERVERNAME\FOLDER
Kindly, help me on this.
July 19th, 2012 5:36am
Do you get the error in BIDS or while running this as a job?Russel Loski, MCT, MCITP Business Intelligence Developer and Database Developer 2008 Blog: http://www.bidn.com/blogs/RussLoski/ Twitter: @sqlmovers
Free Windows Admin Tool Kit Click here and download it now
July 19th, 2012 5:48am
I got the error in BIDS
July 19th, 2012 5:54am
Which account you have given permission on to the shared drive; is the account same as the account Visual Studio is running. Are you assinging some explicit parmaters to connect on your C# code or just trying to access the shared drive.Abhinav
http://bishtabhinav.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
July 19th, 2012 6:18am
code is correct... it seems to be some security error. Do you have access to all files in the folder?
string[] allFiles = Directory.GetFiles(Dts.Variables["User::folder"].Value.ToString());
Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com |
Twitter
July 19th, 2012 6:25am
code is correct... it seems to be some security error. Do you have access to all files in the folder?
string[] allFiles = Directory.GetFiles(Dts.Variables["User::folder"].Value.ToString());
Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com |
Twitter
Free Windows Admin Tool Kit Click here and download it now
July 19th, 2012 6:31am