This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.tableStyle { | |
border-collapse:collapse; | |
border: 1px solid black; | |
text-align:center; | |
width:50%; | |
padding:15px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.tableStyle { | |
border-collapse:collapse; | |
border: 1px solid black; | |
text-align:center; | |
width:50%; | |
padding:15px; | |
} | |
.messages { | |
display:none; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Place custom styles below */ | |
.tableStyle { | |
border-collapse:collapse; | |
border: 1px solid black; | |
text-align:center; | |
width:50%; | |
padding:15px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext, SPHostUrl); | |
using (var clientContext = spContext.CreateUserClientContextForSPAppWeb()) | |
{ | |
if (clientContext != null) | |
{ | |
//code for file size < 2MB | |
//file is the input which we uploaded. It can be taken from Request.Files | |
FileCreationInformation newFile = new FileCreationInformation(); | |
newFile.Content = System.IO.File.ReadAllBytes(file.FileName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext, SPHostUrl); | |
using (var clientContext = spContext.CreateUserClientContextForSPAppWeb()) | |
{ | |
if (clientContext != null) | |
{ | |
//file is uploaded file. Could be read from Request.Files | |
using (FileStream fs = new FileStream(file.FileName, FileMode.Open)) | |
{ | |
//code for file size > 2MB. tested upto 50MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext, SPHostUrl); | |
using (var clientContext = spContext.CreateUserClientContextForSPAppWeb()) | |
{ | |
if (clientContext != null) | |
{ | |
FileCreationInformation newFile = new FileCreationInformation(); | |
//here file is the selected file. In this case of type HttpPostedFileBase | |
newFile.ContentStream = file.InputStream; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.SharePoint.Client; | |
using Microsoft.SharePoint.Client.UserProfiles; | |
using (ClientContext clientContext = new ClientContext("https://tenant.sharepoint.com/")) | |
{ | |
SecureString passWord = new SecureString(); | |
foreach (char c in "your_password".ToCharArray()) passWord.AppendChar(c); | |
clientContext.Credentials = new SharePointOnlineCredentials("your_email_id", passWord); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.SharePoint.Client; | |
using Microsoft.SharePoint.Client.UserProfiles; | |
using (ClientContext clientContext = new ClientContext("https://tenant.sharepoint.com/")) | |
{ | |
SecureString passWord = new SecureString(); | |
foreach (char c in "your_password".ToCharArray()) passWord.AppendChar(c); | |
clientContext.Credentials = new SharePointOnlineCredentials("your_email_id", passWord); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string filePath = "/TestLibrary/TestDocument.pptx"; | |
var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext); | |
using (var sourceContext = spContext.CreateUserClientContextForSPHost()) | |
{ | |
Microsoft.SharePoint.Client.File sourceFile = sourceContext.Web.GetFileByServerRelativeUrl(filePath); | |
//file stream will be used to upload in destination library | |
var fileStream = sourceFile.OpenBinaryStream(); | |
sourceContext.Load(sourceFile, k => k.ServerRelativeUrl, k => k.Name); | |
sourceContext.ExecuteQuery(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeController : Controller | |
{ | |
private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"]; //clientId | |
private static string appKey = ConfigurationManager.AppSettings["ida:AppKey"]; //clientSecret | |
private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"]; //https://login.windows.net/{0} | |
private static string tenant = ConfigurationManager.AppSettings["ida:Tenant"]; //TenantName.onmicrosoft.com | |
private const string ResourceUri = "https://onenote.com"; | |
public static readonly string Authority = String.Format(CultureInfo.InvariantCulture, aadInstance, tenant);//https://login.windows.net/TenantName.onmicrosoft.com | |
Uri returnUri = new Uri("https://localhost:44327/Home/ReturnFlow"); |
OlderNewer