Skip to content Skip to sidebar Skip to footer

How to Upload Cs Files to Dl2

RRS feed

  • Remove From My Forums

 locked

How to upload files from c# asp.net to SharePoint Online library RRS feed

  • Question

  • Hullo guys,

    What is the better way most upload files from c# asp.cyberspace application to SharePoint Online library?

    thanks

All replies

  • Hi,

    We can use CSOM C# to achieve it. The following instance lawmaking for your reference.

    static void Main(string[] args) {	   	string SiteUrl = "https://tenant.sharepoint.com/sites/team"; 	cord DocumentLibrary = "Documents"; 	cord FileName = @"C:\temp\exam.pdf"; 	string CustomerFolder = "Subfolder"; 	string UserName = "admin@tenant.onmicrosoft.com"; 	cord Password = "xxx"; 	UploadFileToSharePoint(SiteUrl, DocumentLibrary, CustomerFolder, FileName, UserName, Password); } private static void UploadFileToSharePoint(string SiteUrl, cord DocLibrary, string ClientSubFolder, cord FileName, string Login, string Password) { 	try 	{ 		#region ConnectToSharePoint 		var securePassword = new SecureString(); 		foreach (char c in Password) 		{ securePassword.AppendChar(c); } 		var onlineCredentials = new SharePointOnlineCredentials(Login, securePassword); 		
    

    Publicar un comentario for "How to Upload Cs Files to Dl2"