1

我正在将 Web (mvc3) 应用程序中的电子邮件服务从 .Net 转换为 sql 数据库邮件。我们要作为附件发送的一些内容已上传到 sql FileTable。当我使用附件的 UNC 路径 (@file_attachments=) 时,我收到此错误:

Msg 22051, Level 16, State 1, Line 0 Attachment file
\\computername\mssqlserver\foldername\foldername\DE107D2C-B945-4F1E-A4B9-4B398C9DE758.jpg)
is invalid.

我可以使用相同的路径直接打开文件,当我将文件复制到本地文件夹时,文件附件很好。我怀疑问题是 FileTable 目录的文件夹权限。但我找不到任何挂钩来设置该文件夹的权限。

我正在使用 Windows 身份验证在 SSMS(本地 sql 实例)中本地运行 EXECUTE msdb.dbo.sp_send_dbmail。

任何建议将不胜感激。

4

2 回答 2

1

This behavior was validated in the Microsoft Database Engine forum and I submitted feedback: https://connect.microsoft.com/SQLServer/feedback/details/756716/sql-server-database-mail-attachments-from-filetable-msg-22051-file-is-invalid

Note that the error code I had in this title should be 22051 and not 22015.

In the mean time, I'm using a work around of copying the files using the sql command shell to another local folder, and using that path for the attachment

Thanks.

于 2012-08-02T20:38:18.417 回答
0

将您的附件文件夹共享给存在附件文件的网络服务用户。并将 \\ip_addres\filefolder\abc.pdf 之类的附件文件路径提供给 send_dbmail 存储过程。如果文件和 sql 服务器在不同的机器上,这将起作用

于 2013-04-10T13:21:05.683 回答