Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string file = @"Path Of the file";
- System.IO.FileStream fs = new System.IO.FileStream(file, System.IO.FileMode.Open, System.IO.FileAccess.Read);
- using (var ctx = new AuthenticationManager().GetAppOnlyAuthenticatedContext(siteUrl, "CLIENTID","CLIENTSECRET"))
- {
- try
- {
- ctx.Load(ctx.Web, p => p.Title);
- ctx.ExecuteQuery();
- Console.WriteLine(ctx.Web.Title);
- Microsoft.SharePoint.Client.File.SaveBinaryDirect(ctx, "RelativePathToDocumentLibrary" + "/test.docx", fs, false);
- }
- catch (Exception ex)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement