<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating a File parameter for a GP tool in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-a-file-parameter-for-a-gp-tool/m-p/1147614#M20430</link>
    <description>&lt;P&gt;I can see one problem with your code and that is you create&amp;nbsp;pGXFileFilter and set it to file type "jxl" then you overwrite the same object setting the file type to "xls".&lt;/P&gt;</description>
    <pubDate>Thu, 24 Feb 2022 17:27:06 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2022-02-24T17:27:06Z</dc:date>
    <item>
      <title>Creating a File parameter for a GP tool</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-a-file-parameter-for-a-gp-tool/m-p/1145430#M20425</link>
      <description>&lt;P&gt;I created some ArcObjects code that creates a geoprocessing tool that creates a featureclass from some input files. The code creates a GP tool that works as it should, except for one problem: the GP parameter for the input files accepts all files when it is supposed to only accept files with the extension .jxl or .xls.&lt;/P&gt;&lt;P&gt;There is no documentation on how to do this, but below is the code snippet of what I wrote to create the input file parameter.&amp;nbsp; I've also converted the tool to a Python tool (which has much better documentation) and it does filter input files to just the allowed ones. I assume the underlying objects are the same for the .Net SDK as for ArcPy, so there should be a way to get the .net authored tool to work as well. I also looked for clues in the Pro SDK, but came up with nothing since Pro doesn't even support creating GP tools with .net.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        parameter = New GPParameterClass()
        Dim inputType As IGPDataType = New DEFileTypeClass()

        Dim pGXFileFilter As IGxFileFilter = New GxFileFilterClass
        pGXFileFilter.AddFileType("jxl", "Trimble JXL Files", "")
        pGXFileFilter = New GxFileFilterClass
        pGXFileFilter.AddFileType("xls", "Excel Files", "")
        Dim pGXFilterInfo As IGxFilterInfo
        pGXFilterInfo = CType(inputType, IGxFilterInfo)
        pGXFilterInfo.OpenGxObjectFilters.Add(pGXFileFilter)
        pGXFilterInfo.SaveGxObjectFilters.Add(pGXFileFilter)

        Dim mvType As IGPMultiValueType = New GPMultiValueTypeClass()
        mvType.MemberDataType = inputType
        Dim mvValue As IGPMultiValue = New GPMultiValueClass()
        mvValue.MemberDataType = inputType

        parameter.Name = "input_files"
        parameter.DisplayName = "Input Files"
        parameter.ParameterType = esriGPParameterType.esriGPParameterTypeRequired

        parameter.Direction = esriGPParameterDirection.esriGPParameterDirectionInput
        parameter.DataType = CType(mvType, IGPDataType)
        parameter.Value = CType(mvValue, IGPValue)
        pParameters.Add(parameter)

        ' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 17 Feb 2022 23:41:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-a-file-parameter-for-a-gp-tool/m-p/1145430#M20425</guid>
      <dc:creator>BerndtNording</dc:creator>
      <dc:date>2022-02-17T23:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a File parameter for a GP tool</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-a-file-parameter-for-a-gp-tool/m-p/1147614#M20430</link>
      <description>&lt;P&gt;I can see one problem with your code and that is you create&amp;nbsp;pGXFileFilter and set it to file type "jxl" then you overwrite the same object setting the file type to "xls".&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 17:27:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-a-file-parameter-for-a-gp-tool/m-p/1147614#M20430</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2022-02-24T17:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a File parameter for a GP tool</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-a-file-parameter-for-a-gp-tool/m-p/1147680#M20431</link>
      <description>&lt;P&gt;Yes, you are right! But that error should still restrict the file types to just .xls. After correcting that error, the tool still allows any type of file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 19:16:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-a-file-parameter-for-a-gp-tool/m-p/1147680#M20431</guid>
      <dc:creator>BerndtNording</dc:creator>
      <dc:date>2022-02-24T19:16:04Z</dc:date>
    </item>
  </channel>
</rss>

