ACAPI_​Favorite_​Import

Imports the contents of a Favorites file or folder into the plan.

    GSErrCode  ACAPI_Favorite_Import (
        const IO::Location&                         location,
        const API_FavoriteFolderHierarchy&          targetFolder,
        bool                                        importFolders,
        API_FavoriteNameConflictResolutionPolicy    conflictPolicy,
        GS::UniString*                              firstConflictName = nullptr
    );

 

Parameters

location
[in] The path to the Favorite file or folder to import.
targetFolder
[in] The folder to import the Favorites to.
importFolders
[in] Specifies if the imported folders should be kept (all Favorites will be imported into the targetFolder otherwise).
conflictPolicy
[in] Specifies what to do when an imported Favorite already exists in the plan.

API_FavoriteNameConflictResolutionPolicy

Meaning

API_FavoriteError

If one of the imported Favorites already exists in the plan, return with APIERR_NAMEALREADYUSED and set the firstConflictName parameter to the conflicting name

API_FavoriteSkip

If an imported Favorite already exists in the plan, keep the old one in the plan, and ignore the imported one.

API_FavoriteOverwrite

If an imported Favorite already exists in the plan, keep the imported one and delete the old one in the plan.

API_FavoriteAppend

If an imported Favorite already exists in the plan, generate a new name for the imported one and keep both Favorites.

firstConflictName
[out] The name of the first Favorite that was imported and already existed in the plan. Only filled if the conflictPolicy parameter is API_FavoriteError.

 

Return Values

NoError
The function has completed with success.
APIERR_NOACCESSRIGHT
The Favorites list is not editable in a teamwork project.
APIERR_BADPARS
The location isn’t a valid Favorite file or folder path.
APIERR_NAMEALREADYUSED
The conflictPolicy parameter is API_FavoriteError, and there was a name conflict.

For other common API errors see the API Errors document.

 

Remarks

The API_FavoriteFolderHierarchy type is a typedef of GS::Array<GS::UniString>.

 

Example

For detailed example, please see the Favorite_Test example Add-On.

 

Requirements

Version: API 20 or later
Header: ACAPinc.h

 

See Also

ACAPI_Favorite_Create,
ACAPI_Favorite_Delete,
ACAPI_Favorite_Export,
ACAPI_Favorite_Get,
ACAPI_Favorite_GetNum,
ACAPI_Favorite_Read,

API Functions