Support retrieving multiple file contents on drop
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
**Scenario:**
User grabs multiple attachments in Outlook and drags & drops them into a WPF application. The application should be able to read the contents of all the files.
**Current state:**
The existing `DataObject.GetData("FileContents")` API only returns the first file. Other files need to be accessed by specifying the appropriate `FORMATETC.lindex` member, which is accessible through `DataObject.OleConverter.GetData` but not using the public API.
**Proposed solution:**
Add `public GetData(string format, bool autoConvert, int index)` overload to `System.Windows.DataObject` that would pass the index to the underlying `DataObject.OleConverter.GetData` or `DataObject.DataStore.GetData` method. Ideally, this would be added on the `IDataObject` interface but that would be a breaking change since it's public.
Note: This would enable developers to retrieve file content of all the dropped files. The developer would still need to obtain the file names and count by other means if needed, but reading the associated `FileGroupDescriptor` structure that is accessible through the existing API is much more straightforward then re-implementing the whole `IDataObject` API.
Contributor guide
Assessment
This issue has not been assessed yet.