packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/Shell/KnownFolders/KnownFolderHelper.cs
/// <summary>
/// Returns a known folder given a globally unique identifier.
/// </summary>
/// <param name="knownFolderId">A GUID for the requested known folder.</param>
/// <returns>A known folder representing the specified name.</returns>
/// <exception cref="System.ArgumentException">Thrown if the given Known Folder ID is invalid.</exception>
Returns a known folder given a globally unique identifier.
Returns a known folder given a globally unique identifier .
public static IKnownFolder FromKnownFolderId(Guid knownFolderId)
        {
            IKnownFolderNative knownFolderNative;
            KnownFolderManagerClass knownFolderManager = new KnownFolderManagerClass();
            HResult hr = knownFolderManager.GetFolder(knownFolderId, out knownFolderNative);
            if (hr != HResult.Ok) { throw new ShellException(hr); }
            IKnownFolder kf = GetKnownFolder(knownFolderNative);
            if (kf == null)
            {
                throw new ArgumentException(LocalizedMessages.KnownFolderInvalidGuid, "knownFolderId");
            }
            return kf;
        }
public static IKnownFolder FromKnownFolderId ( Guid knownFolderId ) { IKnownFolderNative knownFolderNative ; KnownFolderManagerClass knownFolderManager = new KnownFolderManagerClass ( ) ; HResult hr = knownFolderManager . GetFolder ( knownFolderId , out knownFolderNative ) ; if ( hr != HResult . Ok ) { throw new ShellException ( hr ) ; } IKnownFolder kf = GetKnownFolder ( knownFolderNative ) ; if ( kf == null ) { throw new ArgumentException ( LocalizedMessages . KnownFolderInvalidGuid , " " ) ; } return kf ; }
Returns a known folder given a globally unique identifier.
Returns a known folder given a globally unique identifier .
A known folder representing the specified name.
A known folder representing the specified name .
Thrown if the given Known Folder ID is invalid.
Thrown if the given Known Folder ID is invalid .
knownFolderId
Guid
A GUID for the requested known folder.
A GUID for the requested known folder .