Home

Error in uploading the document from the network file share to Office 365 document library.

Sajith G H
Contributor

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

3 Replies
Well, the error says that the problem is on the File Share side and not in SPO...does the application have the required permissions to read information from that path?

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);
}

Highlighted

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.

Related Conversations
Sharing an excel sheet public link
shunde3 in Microsoft Teams on
6 Replies
Dont see any Contact in Teams
nicb in Microsoft Teams on
2 Replies
Problem to start Teams in the browser
André Diekmann in Microsoft Teams on
9 Replies