C# graph api upload file one drive
C#
/// <summary>
/// Take a file and upload it to the service
/// </summary>
/// <param name="fileToUpload">The file that we want to upload</param>
/// <param name="uploadToSharePoint">Should we upload to SharePoint or OneDrive?</param>
public async Task UploadSmallFile(StorageFile fileToUpload, bool uploadToSharePoint)
{
Stream fileStream = (await fileToUpload.OpenReadAsync()).AsStreamForRead();
DriveItem uploadedFile = null;
// Do we want OneDrive for Business/Consumer or do we want a SharePoint Site?
if (uploadToSharePoint)
{
uploadedFile = await graphClient.Sites["root"].Drive.Root.ItemWithPath(fileToUpload.Name).Content.Request().PutAsync<DriveItem>(fileStream);
}
else
{
uploadedFile = await graphClient.Me.Drive.Root.ItemWithPath(fileToUpload.Name).Content.Request().PutAsync<DriveItem>(fileStream);
}
}
Also in C#:
- Title
- c# replace string case insensitive
- Category
- C#
- Title
- unity random int
- Category
- C#
- Title
- how to reduce garbage collection c#
- Category
- C#
- Title
- use newtonsoft json to clone object
- Category
- C#
- Title
- unity load scene
- Category
- C#
- Title
- external font family uwp c#
- Category
- C#
- Title
- Failed to retrieve Firebase Instance Id
- Category
- C#
- Title
- linq in c#
- Category
- C#
- Title
- how to open new form on button click in c# xamarin
- Category
- C#
- Title
- what is type unity
- Category
- C#
- Title
- epplus excel vb.net
- Category
- C#
- Title
- c# create a text file
- Category
- C#
- Title
- c# region tag
- Category
- C#
- Title
- c# directories loop
- Category
- C#
- Title
- c# reverse list
- Category
- C#
- Title
- disable a component unity
- Category
- C#
- Title
- c# how to exit program
- Category
- C#
- Title
- iformfile blobclient
- Category
- C#
- Title
- instantiate object in circle
- Category
- C#
- Title
- animations for pause menu
- Category
- C#
- Title
- csharp first element of array
- Category
- C#
- Title
- unity how to rotate something to point to something else
- Category
- C#
- Title
- POST http://localhost:5001/api/v1/identity/login 500 (Internal Server Error) LoginForm.jsx:39 Error: Request failed with status code 500 at createError (createError.js:16) at settle (settle.js:17) at XMLHttpRequest.handleLoad (xhr.js:61)
- Category
- C#
- Title
- unity instantiate
- Category
- C#
- Title
- create asp.net which send email and sms using own api
- Category
- C#
- Title
- check if number is even or odd c#
- Category
- C#
- Title
- remove all array elements c#
- Category
- C#
- Title
- c# System.Resources.MissingManifestResourceException error
- Category
- C#
- Title
- c# get desktop path
- Category
- C#
- Title
- C# public 2d array
- Category
- C#
- Title
- c# iorderedenumerable to dictionary
- Category
- C#
- Title
- How to look at an object unity
- Category
- C#
- Title
- how to work with ascii in c#
- Category
- C#
- Title
- c# null conditional
- Category
- C#
- Title
- index in foreach c#
- Category
- C#
- Title
- c# filesystemwatcher double events
- Category
- C#
- Title
- how to raycast unit
- Category
- C#
- Title
- how to update a project to cross target .net core
- Category
- C#
- Title
- automapper c# initialize error
- Category
- C#
- Title
- how to access first child of parent unity
- Category
- C#
- Title
- c# lambda expression
- Category
- C#
- Title
- c# check if string is only letters and numbers
- Category
- C#
- Title
- unity rotate around axis
- Category
- C#
- Title
- newtonsoft create dynamic object
- Category
- C#
- Title
- c# object list attribute to string
- Category
- C#
- Title
- Int64
- Category
- C#
- Title
- get string character by index c#
- Category
- C#
- Title
- dto and automapper
- Category
- C#
- Title
- list contains type c#
- Category
- C#
- Title
- change label text size wpf C#
- Category
- C#
- Title
- c# how to have a multiline console.writeline
- Category
- C#
- Title
- how to randomly rotate rigidbody of object in unity
- Category
- C#
- Title
- delegate function c#
- Category
- C#
- Title
- what is a protected int c#
- Category
- C#
- Title
- read xml file c#
- Category
- C#
- Title
- c# object to json string
- Category
- C#
- Title
- how to make a string a list of characters c#
- Category
- C#
- Title
- get absolute url c#
- Category
- C#
- Title
- c# make request to rest api
- Category
- C#
- Title
- idbset sqlquery
- Category
- C#
- Title
- unity get decimal part of float
- Category
- C#
- Title
- c# get set
- Category
- C#
- Title
- generate a dropdown list from array data using razor .net mvc
- Category
- C#
- Title
- c# console delay
- Category
- C#
- Title
- C# Into To Tring Debug.Log
- Category
- C#
- Title
- how to create a variable in C#
- Category
- C#
- Title
- c# sql duplicate key exception
- Category
- C#
- Title
- unity normalize vector2
- Category
- C#
- Title
- c# public static string
- Category
- C#
- Title
- sort c#
- Category
- C#
- Title
- unity print to console
- Category
- C#
- Title
- unity c# write line
- Category
- C#
- Title
- c# string to byte array
- Category
- C#
- Title
- unity how to move an object to another object
- Category
- C#
- Title
- how to get object to spawn in a curcle
- Category
- C#
- Title
- unity serializefield
- Category
- C#
- Title
- get list length c#
- Category
- C#
- Title
- windows forms iterate through all controls
- Category
- C#
- Title
- unity 3d mouse look script
- Category
- C#
- Title
- invalidoperationexception c# ui thread
- Category
- C#
- Title
- set rotation to velocity unity
- Category
- C#
- Title
- get day month year from date c#
- Category
- C#
- Title
- uwp roaming data sample
- Category
- C#
- Title
- unity lerp
- Category
- C#
- Title
- how to make an object move in unity
- Category
- C#
- Title
- Execute code every x seconds with Update()
- Category
- C#
- Title
- c# 2 timespan return yesterday
- Category
- C#
- Title
- define a vector c#
- Category
- C#
- Title
- c# else if
- Category
- C#
- Title
- exception handling c#
- Category
- C#
- Title
- c# polymorphism
- Category
- C#
- Title
- devexpress objectspace to session
- Category
- C#
- Title
- input get button uibutton
- Category
- C#
- Title
- how to textbox anywhere on chart in c#
- Category
- C#
- Title
- Move player on planets in unity 2d
- Category
- C#
- Title
- c# foreach arra
- Category
- C#
- Title
- c# switch statement
- Category
- C#
- Title
- Request.ServerVariables["HTTP_X_FORWARDED_FOR"] get only one ipaddress
- Category
- C#
- Title
- vector between two points unity
- Category
- C#
- Title
- git set origin
- Category
- C#