OneDrive/ODConnection.public.cs
/// <summary>
/// Create a new folder as a child of an existing folder, speciifed by parentFolderId.
/// </summary>
/// <param name="parentItemReference"></param>
/// <param name="newFolderName"></param>
/// <returns></returns>
Create a new folder as a child of an existing folder, speciifed by parentFolderId.
Create a new folder as a child of an existing folder speciifed by parentFolderId .
public async Task<ODItem> CreateFolderAsync(ODItemReference parentItemReference, string newFolderName)
        {
            if (!parentItemReference.IsValid())
                throw new ArgumentException("parentItemReference was invalid. Requires either an ID or Path");
            if (string.IsNullOrEmpty(newFolderName)) 
                throw new ArgumentNullException("newFolderName");
            Uri serviceUri = UriForItemReference(parentItemReference, ApiConstants.ChildrenRelationshipName);
            var request = await CreateHttpRequestAsync(serviceUri, ApiConstants.HttpPost);
            request.ContentType = ApiConstants.ContentTypeJson;
            var body = new { name = newFolderName, folder = new { } };
            await SerializeObjectToRequestBody(body, request);
            var item = await DataModelForRequest<ODItem>(request);
            return item;
        }
public async Task < ODItem > CreateFolderAsync ( ODItemReference parentItemReference , string newFolderName ) { if ( ! parentItemReference . IsValid ( ) ) throw new ArgumentException ( " " ) ; if ( string . IsNullOrEmpty ( newFolderName ) ) throw new ArgumentNullException ( " " ) ; Uri serviceUri = UriForItemReference ( parentItemReference , ApiConstants . ChildrenRelationshipName ) ; var request = await CreateHttpRequestAsync ( serviceUri , ApiConstants . HttpPost ) ; request . ContentType = ApiConstants . ContentTypeJson ; var body = new { name = newFolderName , folder = new { } } ; await SerializeObjectToRequestBody ( body , request ) ; var item = await DataModelForRequest < ODItem > ( request ) ; return item ; }
Create a new folder as a child of an existing folder, speciifed by parentFolderId.
Create a new folder as a child of an existing folder speciifed by parentFolderId .
None
parentItemReference
ODItemReference
None
newFolderName
string
None