Select to view content in your preferred language

Programmatically Open Portal on My Organization?

242
1
Jump to solution
06-30-2025 03:46 PM
RogerAsbury
Frequent Contributor

I've seen code online that is super basic that can open the Catalog pane on the Project tab. I'm curious if there is a similar way to open the Catalog pane onto the Portal tab and auto-select "My Organization".

Code is below. Can something be placed into the parameters of the Execute method?

protected override void OnClick()
{
    var commandId = "esri_core_showProjectDockPane";
    var iCommand = FrameworkApplication.GetPlugInWrapper(commandId) as ICommand;
    if (iCommand != null)
    {
        iCommand.Execute(null);
    }
    else
    {
        MessageBox.Show("Command not found: " + commandId, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
    }
}

 

--
Roger Asbury
Analyst/Programmer - Fairbanks North Star Borough
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

This has been added for 3.6. You will be able to write code similar to:

var catalogWindow = Project.GetCatalogPane() as ICatalogWindow;
if (!catalogWindow.IsActiveWindow)
  return;

var catContentType = catalogWindow.GetCurrentContentType();
if (catContentType != CatalogContentType.Portal)
{
   //show the portal tab
   catalogWindow.SetContentTypeAsync(CatalogContentType.Portal);
}
catalogWindow.SetSecondaryPortalContentTypeAsync(
  CatalogSecondaryPortalContentType.UserOrganization);

 

View solution in original post

1 Reply
CharlesMacleod
Esri Regular Contributor

This has been added for 3.6. You will be able to write code similar to:

var catalogWindow = Project.GetCatalogPane() as ICatalogWindow;
if (!catalogWindow.IsActiveWindow)
  return;

var catContentType = catalogWindow.GetCurrentContentType();
if (catContentType != CatalogContentType.Portal)
{
   //show the portal tab
   catalogWindow.SetContentTypeAsync(CatalogContentType.Portal);
}
catalogWindow.SetSecondaryPortalContentTypeAsync(
  CatalogSecondaryPortalContentType.UserOrganization);