OneDrive/ODConnection.public.cs
/// <summary>
/// Copy an item to a new location, optionally providing a new name.
/// </summary>
/// <param name="originalItemReference"></param>
/// <param name="destinationParentItemReference"></param>
/// <param name="optionalFilename"></param>
/// <returns></returns>
Copy an item to a new location, optionally providing a new name.
Copy an item to a new location optionally providing a new name .
public async Task<ODAsyncTask> CopyItemAsync(ODItemReference originalItemReference, ODItemReference destinationParentItemReference, string optionalFilename = null)
        {
            if (!originalItemReference.IsValid())
                throw new ArgumentException("originalItemReference");
            if (!destinationParentItemReference.IsValid())
                throw new ArgumentException("destinationParentItemReference");
            Uri serviceUri = UriForItemReference(originalItemReference, ApiConstants.CopyItemAction);
            var request = await CreateHttpRequestAsync(serviceUri, ApiConstants.HttpPost);
            AddAsyncHeaders(request);
            var postBody = new
            {
                parentReference = destinationParentItemReference,
                name = optionalFilename
            };
            await SerializeObjectToRequestBody(postBody, request);
            return await AsyncTaskResultForRequest(request, serviceUri);
        }
public async Task < ODAsyncTask > CopyItemAsync ( ODItemReference originalItemReference , ODItemReference destinationParentItemReference , string optionalFilename = null ) { if ( ! originalItemReference . IsValid ( ) ) throw new ArgumentException ( " " ) ; if ( ! destinationParentItemReference . IsValid ( ) ) throw new ArgumentException ( " " ) ; Uri serviceUri = UriForItemReference ( originalItemReference , ApiConstants . CopyItemAction ) ; var request = await CreateHttpRequestAsync ( serviceUri , ApiConstants . HttpPost ) ; AddAsyncHeaders ( request ) ; var postBody = new { parentReference = destinationParentItemReference , name = optionalFilename } ; await SerializeObjectToRequestBody ( postBody , request ) ; return await AsyncTaskResultForRequest ( request , serviceUri ) ; }
Copy an item to a new location, optionally providing a new name.
Copy an item to a new location optionally providing a new name .
None
originalItemReference
ODItemReference
None
destinationParentItemReference
ODItemReference
None
optionalFilename
string
None