Click or drag to resize

IFolderWindowsGetFolderOperationControlAsync Method

IT Hit User File System
Method returns whether the Shell should perform the operation.

Namespace:  ITHit.FileSystem.Windows
Assembly:  ITHit.FileSystem.Windows (in ITHit.FileSystem.Windows.dll) Version: 8.1.26791.0-Beta2
Syntax
Task<FolderOperationControl> GetFolderOperationControlAsync(
	FolderOperation fileOperation,
	string targetUserFileSystemPath,
	IntPtr parentWindow,
	FolderControlFlags flags,
	FileAttributes sourceAttributes,
	FileAttributes targetAttributes
)

Parameters

fileOperation
Type: ITHit.FileSystem.WindowsFolderOperation
The operation to perform.
targetUserFileSystemPath
Type: SystemString
Name of the destination folder. This parameter is provided for copy, move and rename operations only. Null for all other operations.
parentWindow
Type: SystemIntPtr
A handle to the window that the copy hook handler should use as the parent for any user interface elements the handler may need to display. If FOF_SILENT is specified in operation, the method should ignore this parameter.
flags
Type: ITHit.FileSystem.WindowsFolderControlFlags
The flags that control the operation FolderControlFlags enum.
sourceAttributes
Type: System.IOFileAttributes
The attributes of the source folder.
targetAttributes
Type: System.IOFileAttributes
The attributes of the destination folder.

Return Value

Type: TaskFolderOperationControl
Value that indicates whether the Shell should perform the operation.
Remarks

To allow or forbid Shell from performing operations, follow these steps:

  1. Derive your class from one of the [!:StorageProviderCopyHookBase] class descendants. Add the GuidAttribute, ProgIdAttribute and ComVisibleAttribute attributes to your class. You do not need to implement any methods in your class.
  2. Register the COM server in your Package.appxmanifest (in case of packaged app).
  3. To register a copy hook handler for cloud folders, call the [!:ShellExtensionRegistrar.RegisterHandler] passing "CopyHook" as a handler name. Note that unlike other handlers, CopyHook must be registered in all cases, regardless if your app is running with or without identity.
  4. Implement the GetFolderOperationControlAsync(FolderOperation, String, IntPtr, FolderControlFlags, FileAttributes, FileAttributes) with your logic.

CopyHook functionality does NOT require package or application identity.

Examples

The code below is part of 'VirtualDrive' C# sample provided with the SDK.

C#
[ComVisible(true)]
[ProgId("VirtualDrive.StorageProviderCopyHook")]
[Guid("4E813313-2227-42AE-BDC9-53C17A9CF812")]
internal class StorageProviderCopyHookIntegrated : StorageProviderCopyHookIntegratedBase
{
    public StorageProviderCopyHookIntegrated() : base(Program.Engine)
      {
    }
}

The code below is part of 'VirtualDrive' C# sample provided with the SDK.

XML
<Extensions>
  <desktop3:Extension Category="windows.cloudFiles">
    <desktop3:CloudFiles>
      <desktop3:CustomStateHandler Clsid="000562AA-2879-4CF1-89E8-0AEC9596FE19"/>
      <desktop3:ThumbnailProviderHandler Clsid="05CF065E-E135-4B2B-9D4D-CFB3FBAC73A4"/>

      <desktop3:ExtendedPropertyHandler Clsid="20000000-0000-0000-0000-000000000001"/>
      <desktop3:BannersHandler Clsid="20000000-0000-0000-0000-000000000001"/>

      <desktop3:CloudFilesContextMenus>
        <desktop3:Verb Id="LockCommand" Clsid="9C923BF3-3A4B-487B-AB4E-B4CF87FD1C25" />
      </desktop3:CloudFilesContextMenus>

      <desktop4:ContentUriSource Clsid="6D45BC7A-D0B7-4913-8984-FD7261550C08"/>

    </desktop3:CloudFiles>
  </desktop3:Extension>
  <com:Extension Category="windows.comServer">
    <com:ComServer>
      <com:ExeServer DisplayName="VirtualDrive.ShellExtension" Executable="VirtualDrive.ShellExtension\VirtualDrive.ShellExtension.exe">
        <com:Class Id="05CF065E-E135-4B2B-9D4D-CFB3FBAC73A4" />
      </com:ExeServer>

      <com:ExeServer DisplayName="VirtualDrive.ShellExtension" Executable="VirtualDrive.ShellExtension\VirtualDrive.ShellExtension.exe">
        <com:Class Id="9C923BF3-3A4B-487B-AB4E-B4CF87FD1C25" />
      </com:ExeServer>

      <com:ExeServer DisplayName="VirtualDrive.ShellExtension" Executable="VirtualDrive.ShellExtension\VirtualDrive.ShellExtension.exe">
          <com:Class Id="000562AA-2879-4CF1-89E8-0AEC9596FE19" />
      </com:ExeServer>

      <com:ExeServer DisplayName="VirtualDrive.ShellExtension" Executable="VirtualDrive.ShellExtension\VirtualDrive.ShellExtension.exe">
          <com:Class Id="6D45BC7A-D0B7-4913-8984-FD7261550C08" />
      </com:ExeServer>

<com:ExeServer DisplayName="VirtualDrive.ShellExtension" Executable="VirtualDrive.ShellExtension\VirtualDrive.ShellExtension.exe">
  <com:Class Id="4E813313-2227-42AE-BDC9-53C17A9CF812" />
</com:ExeServer>

</com:ComServer>
  </com:Extension>
</Extensions>
See Also