Upload a File to Sharepoint Using C#

RRS feed

  • Remove From My Forums

 locked

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

  • Question

  • Hullo guys,

    What is the better way about upload files from c# asp.net awarding to SharePoint Online library?

    thank you

All replies

  • Hi,

    Nosotros can utilize CSOM C# to accomplish it. The following example code for your reference.

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

0 Response to "Upload a File to Sharepoint Using C#"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel