Share this page

# deletePortfolio

## Purpose

This operation deletes an existing portfolio specified by the name or ID.

## Function

By specifying the name or ID of a portfolio, you can use this operation to delete the portfolio. Portfolios that have child portfolios, programs and proposals/projects/assets cannot be deleted. You must use the Remove operations to remove the contents of the portfolio before deleting it.

## Related Information

The following related operations:

- removePortfolioChildren

- removePortfolioPrograms

- removePortfolioContent

## Input

One of the following field is required:

- The portfolio ID

- The portfolio name

## Return

This operation does not return any data.

## Java Interface

`deletePortfolio (DeletePortfolioDocument in)`

Parameters | Description
--- | ---
DeletePortfolioDocument | Wrapper for the input of this operation. See the Java example for construction. One of the following fields is required: Long id String name

## Java Examples

    public void testDeletePortfolioById(Long portfolioId) throws
    Exception {
           System.out.println("testDeletePortfolioById started
    ...");
           PortfolioServiceStub stub = new PortfolioServiceStub(ctx,
    WSURL);
           DeletePortfolioDocument deletePortfolioDocument =
    DeletePortfolioDocument.Factory.newInstance();
           DeletePortfolio deletePortfolio =
    deletePortfolioDocument.addNewDeletePortfolio();
           ReadPortfolioInput portfolioInput =
    deletePortfolio.addNewPortfolio();
           portfolioInput.setId(portfolioId);
           DeletePortfolioResponseDocument response =
    stub.deletePortfolio(deletePortfolioDocument);
        System.out.println("testDeletePortfolioById completed");
       }
       public void testDeletePortfolioByName(String portfolioName)
    throws Exception {
           System.out.println("testDeletePortfolioByName started
    ...");
           PortfolioServiceStub stub = new PortfolioServiceStub(ctx,
    WSURL);
           DeletePortfolioDocument deletePortfolioDocument =
    DeletePortfolioDocument.Factory.newInstance();
           DeletePortfolio deletePortfolio =
    deletePortfolioDocument.addNewDeletePortfolio();
           ReadPortfolioInput portfolioInput =
    deletePortfolio.addNewPortfolio();
           portfolioInput.setName(portfolioName);
           DeletePortfolioResponseDocument response =
    stub.deletePortfolio(deletePortfolioDocument);
           System.out.println("testDeletePortfolioByName
    completed");
       }

## Errors and Exceptions

When an error occurs on this operation, you will see a description of the root cause in the server log or in the response message:

The server log content is similar to the following:

    Exception in thread "main" org.apache.axis2.AxisFault:
    <exception:exceptionDetails xmlns:exception="http://
    www.mercury.com/ppm/ws/exception">
    <exception:detail>[root cause description] </exception:detail>
    </exception:exceptionDetails>

Possible root cause descriptions:

Message Code | Message | Cause(s) | Possible Corrective Action
--- | --- | --- | ---
exception.authorization | You do not have the privilege to take this action. Please consult your PPM Administrator. | You are not authorized to create a portfolio. | Check the user licenses and privileges (access grants)
com.mercury.itg.exceptions.ObjectNotFoundException | Cannot load the {0} with the specified id: {1}. {0} may be deleted by another user. | A portfolio with the specified name or ID cannot be found. | Check the portfolio name or ID.

https://admhelp.microfocus.com PPM 8942
Tips to improve your search results... OpenText™ Project and Portfolio Management Help Center PPM Help 26.2-26.3 All View Local Help Center View Online Help Center Version: