Select to view content in your preferred language

OpenItemDialog not able to browse to the portal node as the initial location

272
3
02-27-2025 01:17 AM
RITASHKOUL
Regular Contributor

 

Hi,

We have created our own startup page. Our page also contains a button "Start with another template". I want the same behavior of this button as the default one (present in the default Pro start page), which is that the initial location should always be the portal node and it should filter to Project Templates (aptx). But I am not able to achieve that using OpenItemDialog.

I tried to include "esri_browsePlaces_Online" in the includes property of BrowseProjectFilter (got this idea from one of the existing questions in the community https://community.esri.com/t5/arcgis-pro-sdk-questions/openitemdialog-local-only-no-portal/td-p/1311...). But still not able to make it work.

Also forced OpenItemDialog to always use initial location by setting property AlwaysUseInitialLocation as true. But still the same issue. 

For me, it is always being opened at the Project node.

Can someone help me on this?

@UmaHarano @Wolf @CharlesMacleod @GKmieliauskas @NarelleChedzey 

Tags (1)
0 Kudos
3 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Try code below:

            BrowseProjectFilter bdf = new BrowseProjectFilter();
            bdf.Name = "Online";
            bdf.Excludes.Add(@"project_browse_place_project");
            bdf.Excludes.Add(@"esri_browsePlaces_Computer");

            OpenItemDialog itemDlg = new OpenItemDialog
            {
                Title = "Open portal items",
                MultiSelect = false,
                BrowseFilter = bdf
            };

            bool? ok = itemDlg.ShowDialog();

 

GKmieliauskas_1-1740655376182.png

 

0 Kudos
RITASHKOUL
Regular Contributor

@GKmieliauskas But I also wanted to filter only on Project Templates (APTX) files. So if any of folders in the Portal node  have project templates file, those should only be visible else no files should be visible.Itried this 

var browseProjectFilter = new BrowseProjectFilter
{
Name = Resources.ProjectTemplatesBrowseFilterName,
FileExtension = ".APTX"
};
browseProjectFilter.Excludes.Add("project_browse_place_project");
browseProjectFilter.Excludes.Add("esri_browsePlaces_Computer");
browseProjectFilter.AddFilter(BrowseProjectFilter.GetFilter("esri_browseDialogFilters_project_templates"));
 
var openItemDialog = new OpenItemDialog
{
Title = "Project Templates (APTX)",
MultiSelect = false,
BrowseFilter = browseProjectFilter,
Filter = ItemFilters.Project_Templates
}; Added the project templates filter but not working. I can all files even if they are not APTX files 
0 Kudos
RITASHKOUL
Regular Contributor

I got this. This will be achieved using BrowseFileMode = true

0 Kudos