Jan 29 2018 03:47 AM
Getting the following error when the console application try to upload the document from the file share to Office 365 document library.
Unhandled Exception: System.UnauthorizedAccessException: Access to the path '\\SAJITH\Attachment' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at O365Scheduler.Program.o365SaveBinaryDirect(ClientContext o365Context, String o365LibraryName, String o365FilePath, String o365FileName) in D:\VS2015 Projects\ClientProjects\O365Scheduler\O365Scheduler\O365Scheduler\Program.cs:line 78
at O365Scheduler.Program.Main(String[] args) in Program.cs:line 17
Jan 29 2018 05:38 AM
Jan 30 2018 04:45 AM
Yes. The console application is running on my user login and has full permission. Still I get the error in FileMode.Open
using (FileStream o365FileStream = new FileStream(o365FilePath, FileMode.Open))
{
Microsoft.SharePoint.Client.File.SaveBinaryDirect(o365Context, o365ServerRelativeUrl, o365FileStream, true);
}
Feb 15 2018 05:39 PM
Not sure it relates, but I had this same error trying to run a program, very recent security update that caused this issue for me. When I right click and 'Run as Administrator' the problem disappeared.