使用此引用为 Windows Share 集成选择正确的DataFormat声明和 API。
DataFormat 引用表
| DataFormat | 发送 API | 接收 API | 典型应用类型 |
|---|---|---|---|
Text |
SetText | GetTextAsync |
备注应用、剪贴板工具、常规文本 |
Uri / WebLink |
SetWebLink | GetWebLinkAsync |
浏览器、书签、消息传送应用 |
ApplicationLink |
SetApplicationLink | GetApplicationLinkAsync |
公开深层链接的应用 |
Html |
SetHtmlFormat | GetHtmlFormatAsync |
电子邮件客户端、格式文本编辑器 |
Bitmap |
SetBitmap | GetBitmapAsync |
照片编辑器、图像查看器 |
StorageItems |
SetStorageItems | GetStorageItemsAsync |
文件管理器、云存储应用 |
Rtf |
SetRtf | GetRtfAsync |
Word处理器、格式文本编辑器 |
Tip
对于 URL,请始终优先于 SetWebLinkSetText。 目标应用仅当内容以 URI 形式到达时,才能生成丰富的链接预览并正确处理导航。
按应用类别划分的 FileType 声明
使用此备忘单为清单选择最窄的 <uap:FileType> 声明集。 声明更少、更具体的类型可减少共享工作表中的干扰,并阻止应用针对无法处理的内容显示。
| 应用类别 | 建议 <uap:FileType> 的声明 |
其他数据格式 |
|---|---|---|
| 照片查看器/编辑器 |
.jpg
.jpeg
.png
.gif
.bmp
.heic
.webp
|
Bitmap、StorageItems |
| 视频播放器 |
.mp4
.mov
.avi
.mkv
.wmv
|
StorageItems |
| 音频播放器 |
.mp3
.flac
.wav
.aac
.m4a
|
StorageItems |
| 文档编辑器 |
.pdf
.docx
.xlsx
.pptx
.txt
|
StorageItems |
| 链接处理程序/浏览器 | (无文件类型) |
Uri、WebLink |
| 消息应用 | (无文件类型或特定附件类型) |
Uri、WebLink、StorageItems |
| Notes 应用 |
.txt
.md
|
Text、StorageItems |
| 云存储/文件移动器 | <uap:SupportsAnyFileType /> |
StorageItems |
Important
<uap:SupportsAnyFileType /> 仅适用于常规用途文件移动器。 对于其他每个应用类别,请声明特定的文件扩展名。 过度广泛的声明是最常见的共享目标 bug。