예제 #1
0
        /// <summary>
        /// Updates the specified WorkbookTable using PATCH.
        /// </summary>
        /// <param name="workbookTableToUpdate">The WorkbookTable to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <exception cref="ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>
        /// <returns>The updated WorkbookTable.</returns>
        public async System.Threading.Tasks.Task <WorkbookTable> UpdateAsync(WorkbookTable workbookTableToUpdate, CancellationToken cancellationToken)
        {
            if (workbookTableToUpdate.AdditionalData != null)
            {
                if (workbookTableToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    workbookTableToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, workbookTableToUpdate.GetType().Name)
                    });
                }
            }
            if (workbookTableToUpdate.AdditionalData != null)
            {
                if (workbookTableToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    workbookTableToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, workbookTableToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <WorkbookTable>(workbookTableToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
예제 #2
0
        /// <summary>
        /// Creates the specified WorkbookTable using POST.
        /// </summary>
        /// <param name="workbookTableToCreate">The WorkbookTable to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created WorkbookTable.</returns>
        public async System.Threading.Tasks.Task <WorkbookTable> CreateAsync(WorkbookTable workbookTableToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <WorkbookTable>(workbookTableToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
예제 #3
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="workbookTableToInitialize">The <see cref="WorkbookTable"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(WorkbookTable workbookTableToInitialize)
        {
            if (workbookTableToInitialize != null && workbookTableToInitialize.AdditionalData != null)
            {
                if (workbookTableToInitialize.Columns != null && workbookTableToInitialize.Columns.CurrentPage != null)
                {
                    workbookTableToInitialize.Columns.AdditionalData = workbookTableToInitialize.AdditionalData;

                    object nextPageLink;
                    workbookTableToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        workbookTableToInitialize.Columns.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                if (workbookTableToInitialize.Rows != null && workbookTableToInitialize.Rows.CurrentPage != null)
                {
                    workbookTableToInitialize.Rows.AdditionalData = workbookTableToInitialize.AdditionalData;

                    object nextPageLink;
                    workbookTableToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        workbookTableToInitialize.Rows.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
예제 #4
0
 /// <summary>
 /// Creates the specified WorkbookTable using POST.
 /// </summary>
 /// <param name="workbookTableToCreate">The WorkbookTable to create.</param>
 /// <returns>The created WorkbookTable.</returns>
 public System.Threading.Tasks.Task <WorkbookTable> CreateAsync(WorkbookTable workbookTableToCreate)
 {
     return(this.CreateAsync(workbookTableToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Issues the PUT request.
 /// </summary>
 /// <param name="workbooktable">The WorkbookTable object to update.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <WorkbookTable> PutAsync(WorkbookTable workbooktable,
                                                             CancellationToken cancellationToken)
 {
     this.Method = "PUT";
     return(this.SendAsync <WorkbookTable>(workbooktable, cancellationToken));
 }
 /// <summary>
 /// Issues the PUT request.
 /// </summary>
 /// <param name="workbooktable">The WorkbookTable object to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <WorkbookTable> PutAsync(WorkbookTable workbooktable)
 {
     return(this.PutAsync(workbooktable, CancellationToken.None));
 }
예제 #7
0
 /// <summary>
 /// Adds the specified WorkbookTable to the collection via POST.
 /// </summary>
 /// <param name="workbookTable">The WorkbookTable to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created WorkbookTable.</returns>
 public System.Threading.Tasks.Task <WorkbookTable> AddAsync(WorkbookTable workbookTable, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <WorkbookTable>(workbookTable, cancellationToken));
 }