2011 - Custom WorkFlow Activity - directoryInfo.GetFiles() exception RRS feed

  • Question

  • You cannot vote on your own post


    I am getting an error when I hit the directoryInfo.GetFiles() line in my Custom Workflow Activity for 2011: 

        var directoryInfo = new DirectoryInfo(@"C:\MyFolder");          

    foreach (var fileInfo in directoryInfo.GetFiles())   

    {         ....      }

    the error is:

    Document General Error: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\System.Activities.InArgument`1[System.String]\'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileSystemEnumerableIterator`1.CommonInit() at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler) at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption) at MyAssembly.WorkflowActivity.SifService.Execute(CodeActivityContext codeActivityContext)

    Does anyone know what this might be? (BTW C:\MyFolder definately exists!)

    Thanks very much

    Wednesday, August 8, 2012 2:36 PM


  • I have been really stupid 

    To get my path I was calling 

            [Input("New Document Folder Path")]   


      public InArgument<string> NewDocumentFolderPath { get; set; }


    var directoryInfo = new DirectoryInfo(NewDocumentFolderPath.ToString());   

     which was giving me the object name not its contents. 

    I am now calling 


    and it works fine.

    Wednesday, August 8, 2012 3:11 PM