packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/Shell/KnownFolders/KnownFolderHelper.cs
/// <summary>
/// Returns the known folder given its canonical name.
/// </summary>
/// <param name="canonicalName">A non-localized canonical name for the known folder, such as MyComputer.</param>
/// <returns>A known folder representing the specified name.</returns>
/// <exception cref="System.ArgumentException">Thrown if the given canonical name is invalid or if the KnownFolder could not be created.</exception>
Returns the known folder given its canonical name.
Returns the known folder given its canonical name .
public static IKnownFolder FromCanonicalName(string canonicalName)
        {
            IKnownFolderNative knownFolderNative;
            IKnownFolderManager knownFolderManager = (IKnownFolderManager)new KnownFolderManagerClass();
            knownFolderManager.GetFolderByName(canonicalName, out knownFolderNative);
            IKnownFolder kf = KnownFolderHelper.GetKnownFolder(knownFolderNative);
            if (kf == null)
            {
                throw new ArgumentException(LocalizedMessages.ShellInvalidCanonicalName, "canonicalName");
            }
            return kf;
        }
public static IKnownFolder FromCanonicalName ( string canonicalName ) { IKnownFolderNative knownFolderNative ; IKnownFolderManager knownFolderManager = ( IKnownFolderManager ) new KnownFolderManagerClass ( ) ; knownFolderManager . GetFolderByName ( canonicalName , out knownFolderNative ) ; IKnownFolder kf = KnownFolderHelper . GetKnownFolder ( knownFolderNative ) ; if ( kf == null ) { throw new ArgumentException ( LocalizedMessages . ShellInvalidCanonicalName , " " ) ; } return kf ; }
Returns the known folder given its canonical name.
Returns the known folder given its canonical name .
A known folder representing the specified name.
A known folder representing the specified name .
Thrown if the given canonical name is invalid or if the KnownFolder could not be created.
Thrown if the given canonical name is invalid or if the KnownFolder could not be created .
canonicalName
string
A non-localized canonical name for the known folder, such as MyComputer.
A non - localized canonical name for the known folder such as MyComputer .