Created
September 6, 2012 18:09
-
-
Save thefringeninja/3659062 to your computer and use it in GitHub Desktop.
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
private List GetCostAnalysisList() | |
{ | |
var lists = Sharepoint.LoadQuery( | |
Sharepoint.Web.Lists.Where(list => list.Title == "cost-analysis-worksheets")); | |
Sharepoint.ExecuteQuery(); | |
return lists.FirstOrDefault(); | |
} | |
private void UploadWorksheetToSharepoint(string fileName, string userName, Stream stream) | |
{ | |
var content = new byte[stream.Length]; | |
stream.Read(content, 0, content.Length); | |
var list = GetCostAnalysisList(); | |
var upload = list.RootFolder.Files.Add(new FileCreationInformation | |
{ | |
Overwrite = true, | |
Url = fileName, | |
Content = content, | |
}); | |
Sharepoint.Load(upload); | |
Sharepoint.ExecuteQuery(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment