Consider this BASIC code: Sub TestMMOutput() wshshell = CreateObject("WScript.Shell") sDocsPath = wshShell.SpecialFolders.Item("MyDocuments") sDocsURL = ConvertToURL(sDocsPath) oMailMerge = CreateUnoService("com.sun.star.text.MailMerge") oMailMerge.OutputURL = sDocsURL End Sub Running this code on Windows results in this error message: BASIC runtime error. An exception occurred Type: com.sun.star.lang.IllegalArgumentException Message: URL is read-only: file:///D:/Documents. This error is produced because SwXMailMerge::setPropertyValue calls UCB_IsReadOnlyFileName, and the latter returns the result based on what filesystem attributes tell (the actual work is done in osl_getFileStatus); but as mentioned in MS documentation [1], [2], FILE_ATTRIBUTE_READONLY "is not honored on directories" - so it must be ignored on Windows, by removing this flag when it's a directory. [1] https://learn.microsoft.com/en-us/windows/desktop/FileIO/file-attribute-constants [2] https://support.microsoft.com/kb/326549
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/d724b51c7da391c9afe5e47476d432aecf1c4c67 tdf#157448: ignore FILE_ATTRIBUTE_READONLY when FILE_ATTRIBUTE_DIRECTORY is set It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.