Class MediaLibraryInfoProvider
- Namespace
- CMS.MediaLibrary
- Assembly
- CMS.MediaLibrary.dll
Class providing media library info management.
[ProviderInterface(typeof(IMediaLibraryInfoProvider))]
[Obsolete("Media libraries and their APIs are obsolete and will be discontinued in the future. Please migrate all media library files to Content hub and use their corresponding content item APIs.")]
public class MediaLibraryInfoProvider : AbstractInfoProvider<MediaLibraryInfo, MediaLibraryInfoProvider>, IInfoProvider, ICustomizableProvider, IBulkOperationProvider, IWebFarmProvider, IInfoValidator<MediaLibraryInfo>, IInfoByGuidProvider<MediaLibraryInfo>, IBulkInfoProvider<MediaLibraryInfo>, IMediaLibraryInfoProvider, IInfoProvider<MediaLibraryInfo>, IInfoByIdProvider<MediaLibraryInfo>, IInfoByNameProvider<MediaLibraryInfo>
- Inheritance
-
objectMediaLibraryInfoProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
MediaLibraryInfoProvider()
Constructor
public MediaLibraryInfoProvider()
Fields
CURRENT_LIBRARY
Current media library.
public const string CURRENT_LIBRARY = "##CURRENT_LIBRARY##"
Field Value
- string
Properties
DeletePhysicalFiles
Indicates if media files physical files should be deleted.
public static bool DeletePhysicalFiles { get; set; }
Property Value
- bool
Methods
CopyMediaLibraryFolder(int, string, string, int, bool)
Copy media library folder.
public static void CopyMediaLibraryFolder(int libraryID, string origPath, string newPath, int userId, bool synchronization = false)
Parameters
libraryIDintLibrary ID
origPathstringOld folder path within the library folder
newPathstringNew folder path within the library folder
userIdintID of the user performing the action
synchronizationboolIndicates if method is running by web farms synchronization
CopyMediaLibraryFolderInternal(int, string, string, bool, int)
Copy media library folder.
protected virtual void CopyMediaLibraryFolderInternal(int libraryID, string origPath, string newPath, bool synchronization, int userId)
Parameters
libraryIDintLibrary ID
origPathstringOld folder path within the library folder
newPathstringNew folder path within the library folder
synchronizationboolIndicates if method is running by web farms synchronization
userIdintID of the user performing the action
CreateMediaLibraryFolder(int, string, bool)
Creates folder within specified library.
public static void CreateMediaLibraryFolder(int libraryID, string newFolderPath, bool synchronization = false)
Parameters
libraryIDintLibrary ID
newFolderPathstringNew folder path
synchronizationboolIndicates if method is running by web farms synchronization
CreateMediaLibraryFolderInternal(int, string, bool)
Creates folder within specified library.
protected virtual void CreateMediaLibraryFolderInternal(int libraryID, string newFolderPath, bool synchronization)
Parameters
libraryIDintLibrary ID
newFolderPathstringNew folder path
synchronizationboolIndicates if method is running by web farms synchronization
DeleteMediaLibrariesFolders(ArrayList)
Delete all media libraries folders.
public static void DeleteMediaLibrariesFolders(ArrayList folders)
Parameters
foldersArrayListList of folder to delete
DeleteMediaLibrariesFoldersInternal(ArrayList)
Delete all media libraries folders.
protected virtual void DeleteMediaLibrariesFoldersInternal(ArrayList folders)
Parameters
foldersArrayListList of folder to delete
DeleteMediaLibraryFolder(int, string, bool)
Delete folder from media library.
public static void DeleteMediaLibraryFolder(int libraryID, string folderPath, bool synchronization)
Parameters
libraryIDintMedia library ID
folderPathstringPath to the folder within the library
synchronizationboolIndicates if method is running by web farms synchronization
DeleteMediaLibraryFolder(string, bool)
Delete media library root folder from media root directory. ~/media/
public static void DeleteMediaLibraryFolder(string folder, bool synchronization)
Parameters
folderstringMedia library folder
synchronizationboolIndicates if method is running by web farms synchronization
DeleteMediaLibraryFolderInternal(int, string, bool)
Delete folder from media library.
protected virtual void DeleteMediaLibraryFolderInternal(int libraryID, string folderPath, bool synchronization)
Parameters
libraryIDintMedia library ID
folderPathstringPath to the folder within the library
synchronizationboolIndicates if method is running by web farms synchronization
DeleteMediaLibraryFolderInternal(string, bool)
Delete media library root folder from media root directory. ~/media/
protected virtual void DeleteMediaLibraryFolderInternal(string folder, bool synchronization)
Parameters
folderstringMedia library folder
synchronizationboolIndicates if method is running by web farms synchronization
Get(string)
Gets an instance of info object based on its code name.
public override MediaLibraryInfo Get(string name)
Parameters
namestringCode name of the info object to look for.
Returns
- MediaLibraryInfo
Returns an instance of MediaLibraryInfo corresponding to
nameor null.
GetAsync(string, CancellationToken?)
Asynchronously gets an instance of info object based on its code name.
public override Task<MediaLibraryInfo> GetAsync(string name, CancellationToken? cancellationToken = null)
Parameters
namestringCode name of the info object to look for.
cancellationTokenCancellationToken?The cancellation instruction.
Returns
- Task<MediaLibraryInfo>
Returns a task returning either an instance of MediaLibraryInfo corresponding to
nameor null.
GetMediaLibraries(string, string, int, string)
Returns information on libraries matching specified criteria.
public static ObjectQuery<MediaLibraryInfo> GetMediaLibraries(string where, string orderBy = null, int topN = 0, string columns = null)
Parameters
wherestringWhere condition to filter data
orderBystringOrder by statement to use
topNintTop N records
columnsstringList of columns to be returned
Returns
GetMediaLibraryFolderPath(MediaLibraryInfo, string)
Gets the folder path for the given media library
public static string GetMediaLibraryFolderPath(MediaLibraryInfo libInfo, string webFullPath = null)
Parameters
libInfoMediaLibraryInfoMedia library info
webFullPathstringPhysical path to the root of the web project (e.g. c:\WebProject), if it is not specified web application physical path is used
Returns
- string
GetMediaLibraryFolderPath(int, string)
Returns physical path to the specified library.
public static string GetMediaLibraryFolderPath(int libraryId, string webFullPath = null)
Parameters
libraryIdintLibrary ID
webFullPathstringPhysical path to the root of the web project (e.g. c:\WebProject), if it is not specified web application physical path is used
Returns
- string
GetMediaLibraryFolderPath(string, string)
Returns physical path to the specified library folder.
public static string GetMediaLibraryFolderPath(string libraryFolder, string webFullPath = null)
Parameters
libraryFolderstringLibrary folder name
webFullPathstringPhysical path to the root of the web project (e.g. c:\WebProject), if it is not specified web application physical path is used
Returns
- string
GetMediaLibraryFolderPathInternal(string, string)
Returns physical path to the specified library folder.
protected virtual string GetMediaLibraryFolderPathInternal(string libraryFolder, string webFullPath = null)
Parameters
libraryFolderstringLibrary folder name
webFullPathstringPhysical path to the root of the web project (e.g. c:\WebProject), if it is not specified web application physical path is used
Returns
- string
MoveMediaLibraryFolder(int, string, string, bool)
Moves media library folder.
public static void MoveMediaLibraryFolder(int libraryID, string origPath, string newPath, bool synchronization = false)
Parameters
libraryIDintLibrary ID
origPathstringOld folder path within the library folder
newPathstringNew folder path within the library folder
synchronizationboolIndicates if method is running by web farms synchronization
MoveMediaLibraryFolderInternal(int, string, string, bool)
Moves media library folder.
protected virtual void MoveMediaLibraryFolderInternal(int libraryID, string origPath, string newPath, bool synchronization)
Parameters
libraryIDintLibrary ID
origPathstringOld folder path within the library folder
newPathstringNew folder path within the library folder
synchronizationboolIndicates if method is running by web farms synchronization
RenameMediaLibraryFolder(int, string, string, bool)
Rename folder within specified library.
public static void RenameMediaLibraryFolder(int libraryID, string folderPath, string newFolderPath, bool synchronization = false)
Parameters
libraryIDintLibrary ID
folderPathstringOriginal folder path
newFolderPathstringNew folder path
synchronizationboolIndicates if method is running by web farms synchronization
RenameMediaLibraryFolderInternal(int, string, string, bool)
Rename folder within specified library.
protected virtual void RenameMediaLibraryFolderInternal(int libraryID, string folderPath, string newFolderPath, bool synchronization)
Parameters
libraryIDintLibrary ID
folderPathstringOriginal folder path
newFolderPathstringNew folder path
synchronizationboolIndicates if method is running by web farms synchronization
SetInfo(MediaLibraryInfo)
Inserts or Updates the object to the database.
protected override void SetInfo(MediaLibraryInfo info)
Parameters
infoMediaLibraryInfoObject to insert / update
Validate(MediaLibraryInfo)
Validates whether the info object's state satisfies domain specific constraints and returns the validation result.
public override InfoValidationResult Validate(MediaLibraryInfo info)
Parameters
infoMediaLibraryInfoInfo object to be validated.
Returns
- InfoValidationResult
Returns validation result with IsValid set to true, if
infois valid. Otherwise returns result with the flag set to false and a corresponding error message.
Remarks
Implement IInfoValidator<TInfo> and register it into the system to perform domain specific validation for MediaLibraryInfo. The system invokes the registered validators as part of validation performed by this method.
The default implementation validates the code name to contain only allowed characters and to be unique.
Exceptions
- ArgumentNullException
Thrown when
infois null.
- See Also
-
IInfoValidator<TInfo>