Ejemplo n.º 1
0
        public async Task CreateFolder(string path, string name, OneDriveCredentials credentials, CancellationToken cancellationToken)
        {
            string url = string.IsNullOrEmpty(path)
                ? "/drive/special/approot/children"
                : string.Format("/drive/special/approot:/{0}:/children", path);

            string accessToken = await credentials.GetAccessToken(cancellationToken);

            var data = new CreateFolderParameters
            {
                name = name,
                folder = new object(),
                conflictBehavior = "fail"
            };

            var httpRequest = PrepareHttpRequestOptions(url, accessToken, cancellationToken);
            httpRequest.RequestContent = JsonConvert.SerializeObject(data);
            httpRequest.RequestContentType = "application/json";
            httpRequest.LogErrorResponseBody = false;

            await PostRequest<object>(httpRequest, cancellationToken);
        }
Ejemplo n.º 2
0
        public async Task CreateFolder(string path, string name, OneDriveCredentials credentials, CancellationToken cancellationToken)
        {
            string url = string.IsNullOrEmpty(path)
                ? "/drive/special/approot/children"
                : string.Format("/drive/special/approot:/{0}:/children", path);

            string accessToken = await credentials.GetAccessToken(cancellationToken);

            var data = new CreateFolderParameters
            {
                name             = name,
                folder           = new object(),
                conflictBehavior = "fail"
            };

            var httpRequest = PrepareHttpRequestOptions(url, accessToken, cancellationToken);

            httpRequest.RequestContent       = JsonConvert.SerializeObject(data);
            httpRequest.RequestContentType   = "application/json";
            httpRequest.LogErrorResponseBody = false;

            await PostRequest <object>(httpRequest, cancellationToken);
        }