SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.24k stars 1.01k forks source link

Uploading file to sharepoint online using .net standard 2.0 in Asp.net core 3.1 application #7433

Open kinunga opened 2 years ago

kinunga commented 2 years ago

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

šŸ’„ SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

Additional environment details

Describe the bug / error

I used CSOM for .NET Standard to upload a file on sharepoint in my web application (ASP.net core 3.1). The upload is working well on my dev. environment (Windows/Visual studio 2019). But when i deploy my app on linux server (ubuntu). The upload doesn't working, it shows me this message error: Server relative urls must start with SPWeb.ServerRelativeUrl has anyone got an idea on why am I getting this error ?

Steps to reproduce

1.Using CSOM for .NET Standard to upload a file on Sharepoit in a Web application (ASP.net Core 3.1) 2.Test the upload on dev. Environment (Windows / Visual Studio 2019). In my case, this is working well 3.Deploy the app on linux server (ubuntu). The upload doesn't work, shows this message error: Server relative urls must start with SPWeb.ServerRelativeUrl

Expected behavior

File uploaded on sharepoint for both envirnoment (dev.environment "Windows / Visual Studio 2019" and on linux server "ubuntu")

ghost commented 2 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

kinunga commented 2 years ago

I found what was wrong, I don't know why, but "Microsoft.SharePoint.Client.List.RootFolder.Folders.GetByurl("folder name") doesn't work on linux server (tested on ubuntu) but working well on my windows dev. evironment.

rshingavi97 commented 2 years ago

Could you provide the code snippet in order to upload the file to shareoint site