OneDrive/ODConnection.public.cs
/// <summary>
/// Uploads the contents of sourceFileStream to the service as the contents for itemId. This method can
/// be used to replace the contents of an existing file or create a new file if the itemReference property
/// is set to a path-only.
/// </summary>
/// <param name="itemReference"></param>
/// <param name="sourceFileStream"></param>
/// <param name="options"></param>
/// <returns></returns>
Uploads the contents of sourceFileStream to the service as the contents for itemId. This method can
be used to replace the contents of an existing file or create a new file if the itemReference property
is set to a path-only.
Uploads the contents of sourceFileStream to the service as the contents for itemId . This method can be used to replace the contents of an existing file or create a new file if the itemReference property is set to a path - only .
public async Task<ODItem> PutContentsAsync(ODItemReference itemReference, Stream sourceFileStream, ItemUploadOptions options)
        {
            if (!itemReference.IsValid())
                throw new ArgumentException("ItemReference was invalid. Requires either an ID or Path");
            if (null == options)
                throw new ArgumentNullException("options");
            if (null == sourceFileStream) 
                throw new ArgumentNullException("sourceFileStream");
            if (sourceFileStream.Length > MaxRegularUploadSize)
                throw new ODException("Stream is longer than the maximum upload size allowed.");
            long localItemSize;
            if (!sourceFileStream.TryGetLength(out localItemSize))
            {
                throw new ODException("Couldn't get length of sourceFileStream.");
            }
            Uri serviceUri = UriForItemReference(itemReference);
            return await UploadToUrl(sourceFileStream, options, localItemSize, serviceUri);
        }
public async Task < ODItem > PutContentsAsync ( ODItemReference itemReference , Stream sourceFileStream , ItemUploadOptions options ) { if ( ! itemReference . IsValid ( ) ) throw new ArgumentException ( " " ) ; if ( null == options ) throw new ArgumentNullException ( " " ) ; if ( null == sourceFileStream ) throw new ArgumentNullException ( " " ) ; if ( sourceFileStream . Length > MaxRegularUploadSize ) throw new ODException ( " " ) ; long localItemSize ; if ( ! sourceFileStream . TryGetLength ( out localItemSize ) ) { throw new ODException ( " " ) ; } Uri serviceUri = UriForItemReference ( itemReference ) ; return await UploadToUrl ( sourceFileStream , options , localItemSize , serviceUri ) ; }
Uploads the contents of sourceFileStream to the service as the contents for itemId.
Uploads the contents of sourceFileStream to the service as the contents for itemId .
None
itemReference
ODItemReference
None
sourceFileStream
Stream
None
options
ItemUploadOptions
None