Last active
August 29, 2015 14:05
-
-
Save chakkaradeep/b8895ac7ece58471ad5c to your computer and use it in GitHub Desktop.
Office 365 API My Files - Create File
This file contains hidden or 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 static async Task<MyFile> Create(string strFileName, Stream streamFileContent) | |
{ | |
//MyFile is the business object | |
MyFile myFile = null; | |
//add the file to OneDrive | |
//file name will be the full file name along with the extension | |
IFile file = await _spFilesClient.Files.AddAsync(strFileName, true, streamFileContent); | |
if (file != null) | |
{ | |
//creae the business object | |
myFile = new MyFile(); | |
myFile.Id = file.Id; | |
myFile.Name = file.Name; | |
myFile.ContentStream = streamFileContent; | |
} | |
//return the business object | |
return myFile; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment