asked on
URLDownloadToFile gives hex 800C0006 error (udErrObjectNotFound) in Access VBA
URLDownloadToFile gives hex 800C0006 error (udErrObjectNotFound) in Access VBA when retrieving SharePoint list attachments. Fails for 35 attachments, all of which have a Euro symbol (€) in the filename. The other 4358 attachments work fine. Here's the code:
Result = URLDownloadToFile(0, pURL, pPath & pFilename, 16, 0)
Same result if 4th parameter is 0, rather than 16 (BINDF_GETNEWESTVERSION).
Have removed Euro symbol from output disk pFilename, but error still occurs. That indicates the error is occurring during the retrieval phase, not on the disk save phase.
Only circumvention is to manually download these attachments in SharePoint (which works fine) and save them (even with same filename).
Any ideas or suggestions?
ASKER
Daniel, when first reading your comment, I missed the "encode URL" part. I added URL encoding to my program, and that resolved the issue. It also handled a few attachments with single-quotes, pound-signs, and European accented characters! I'm marking your message as the solution. Please let me offer a delayed, but profound, thank you!
ASKER
Thanks, Daniel. Yes, the URLs are ok. Keep in mind that 4358 worked ok (none had a Euro symbol in the filename), and only 35 failed (they ALL had a Euro symbol). We're migrating from a legacy SharePoint app to a modern OTS package and need to export/import the data and attachments. The attachments have been collected over the years, so I have no control over the history. Interestingly, SharePoint has no problem with these filenames, importing, viewing, or exporting. It's only the URLDownloadToFile module that seems to have the issue.