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
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies