Codeunit "Media Cleanup"

ID 1927
Namespace: System.DataAdministration

Provides an interface for cleaning up Media

Properties

Name Value
Access Public

Methods

GetDetachedTenantMedia

Returns a list of detached tenant media. This media may be detached by itself or have an detached Media Set pointing to them.

procedure GetDetachedTenantMedia(var TempTenantMedia: Record "Tenant Media" temporary, LoadMediaContent: Boolean): Boolean

Parameters

Name Type Description
TempTenantMedia Record "Tenant Media" temporary

The detached media. Must be a temporary table.

LoadMediaContent Boolean

Whether to copy over all media content. This may cause the call to be very expensive.

Returns

Type Description
Boolean

Whether all detached media were loaded into the Tenant Media Record. To prevent excessive waiting times, at most 10.000 records are loaded.

GetDetachedTenantMedia

Returns a list of detached tenant media. This media may be detached by itself or have an detached Media Set pointing to them.

procedure GetDetachedTenantMedia(var TempTenantMedia: Record "Tenant Media" temporary, LoadMediaContent: Boolean, RecordLimit: Integer): Boolean

Parameters

Name Type Description
TempTenantMedia Record "Tenant Media" temporary

The detached media. Must be a temporary table.

LoadMediaContent Boolean

Whether to copy over all media content. This may cause the call to be very expensive.

RecordLimit Integer

Specifies the maximum amount of records to load. It's recommended to not set this too high.

Returns

Type Description
Boolean

Whether all detached media were loaded into the Tenant Media Record.

GetTenantMediaFromDetachedMediaSet

Returns a list of detached tenant media. This media may be detached by itself or have an detached Media Set pointing to them.

procedure GetTenantMediaFromDetachedMediaSet(var TempTenantMedia: Record "Tenant Media" temporary, LoadMediaContent: Boolean): Boolean

Parameters

Name Type Description
TempTenantMedia Record "Tenant Media" temporary

The detached media. Must be a temporary table.

LoadMediaContent Boolean

Whether to copy over all media content. This may cause the call to be very expensive.

Returns

Type Description
Boolean

Whether all detached media were loaded into the Tenant Media Record. To prevent excessive waiting times, at most 100.000 records are loaded.

GetTenantMediaFromDetachedMediaSet

Returns a list of detached tenant media. This media may be detached by itself or have an detached Media Set pointing to them.

procedure GetTenantMediaFromDetachedMediaSet(var TempTenantMedia: Record "Tenant Media" temporary, LoadMediaContent: Boolean, RecordLimit: Integer): Boolean

Parameters

Name Type Description
TempTenantMedia Record "Tenant Media" temporary

The detached media. Must be a temporary table.

LoadMediaContent Boolean

Whether to copy over all media content. This may cause the call to be very expensive.

RecordLimit Integer

Specifies the maximum amount of records to load. It's recommended to not set this too high.

Returns

Type Description
Boolean

Whether all detached media were loaded into the Tenant Media Record.

DownloadTenantMedia

Downloads the content of the specified tenant media id.

procedure DownloadTenantMedia(MediaId: Guid): Boolean

Parameters

Name Type Description
MediaId Guid

ID of the tenant media.

Returns

Type Description
Boolean

DeleteDetachedTenantMedia

Deletes the specified Tenant Media records specified in the temporary record if it is detached.

procedure DeleteDetachedTenantMedia(var TempTenantMedia: Record "Tenant Media" temporary)

Parameters

Name Type Description
TempTenantMedia Record "Tenant Media" temporary

The list of media that should be deleted. Must be a temporary table.

DeleteDetachedTenantMediaSet

Deletes all detached tenant media sets.

procedure DeleteDetachedTenantMediaSet()

DeleteDetachedTenantMedia

Deletes all detached tenant media. Note: This function will delete detached media in batches of 100 and commit in between each batch. This is to ensure we don't get stuck always trying to delete the same media and time out.

procedure DeleteDetachedTenantMedia()

ScheduleCleanupDetachedMedia

Schedules a background task which will remove both detached Tenant Media and detached Tenant Media Set. If user cannot schedule tasks, will suggest running the task in the foreground.

procedure ScheduleCleanupDetachedMedia()

See also