/// <summary>Retrieves the path of a known folder</summary> /// <param name="knownFolderId">GUID of the known folderparam> /// <returns>The path of the known folder with the specified GUID</returns> private static string getKnownFolder(Guid knownFolderId) { var instance = new KnownFolderManagerImpl(); if (instance == null) { throw new COMException("Could not create instance of known folder manager coclass"); } IKnownFolderManager knownFolderManager = instance as IKnownFolderManager; if (knownFolderManager == null) { throw new COMException("Could not query known folder manager interface"); } IKnownFolder knownFolder; knownFolderManager.GetFolder(ref knownFolderId, out knownFolder); if (knownFolder == null) { throw new COMException("Could not query known folder"); } string path; knownFolder.GetPath(0, out path); return(path); }
/// <summary>Retrieves the path of a known folder</summary> /// <param name="knownFolderId">GUID of the known folderparam> /// <returns>The path of the known folder with the specified GUID</returns> private static string getKnownFolder(Guid knownFolderId) { var instance = new KnownFolderManagerImpl(); if (instance == null) { throw new COMException("Could not create instance of known folder manager coclass"); } IKnownFolderManager knownFolderManager = instance as IKnownFolderManager; if (knownFolderManager == null) { throw new COMException("Could not query known folder manager interface"); } IKnownFolder knownFolder; knownFolderManager.GetFolder(ref knownFolderId, out knownFolder); if (knownFolder == null) { throw new COMException("Could not query known folder"); } string path; knownFolder.GetPath(0, out path); return path; }