/// <summary> /// Updates the specified WorkbookComment using PATCH. /// </summary> /// <param name="workbookCommentToUpdate">The WorkbookComment 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 WorkbookComment.</returns> public async System.Threading.Tasks.Task <WorkbookComment> UpdateAsync(WorkbookComment workbookCommentToUpdate, CancellationToken cancellationToken) { if (workbookCommentToUpdate.AdditionalData != null) { if (workbookCommentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || workbookCommentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, workbookCommentToUpdate.GetType().Name) }); } } if (workbookCommentToUpdate.AdditionalData != null) { if (workbookCommentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || workbookCommentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, workbookCommentToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <WorkbookComment>(workbookCommentToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Creates the specified WorkbookComment using POST. /// </summary> /// <param name="workbookCommentToCreate">The WorkbookComment to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created WorkbookComment.</returns> public async System.Threading.Tasks.Task <WorkbookComment> CreateAsync(WorkbookComment workbookCommentToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <WorkbookComment>(workbookCommentToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="workbookCommentToInitialize">The <see cref="WorkbookComment"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(WorkbookComment workbookCommentToInitialize) { if (workbookCommentToInitialize != null && workbookCommentToInitialize.AdditionalData != null) { if (workbookCommentToInitialize.Replies != null && workbookCommentToInitialize.Replies.CurrentPage != null) { workbookCommentToInitialize.Replies.AdditionalData = workbookCommentToInitialize.AdditionalData; object nextPageLink; workbookCommentToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { workbookCommentToInitialize.Replies.InitializeNextPageRequest( this.Client, nextPageLinkString); } } } }
/// <summary> /// Creates the specified WorkbookComment using POST. /// </summary> /// <param name="workbookCommentToCreate">The WorkbookComment to create.</param> /// <returns>The created WorkbookComment.</returns> public System.Threading.Tasks.Task <WorkbookComment> CreateAsync(WorkbookComment workbookCommentToCreate) { return(this.CreateAsync(workbookCommentToCreate, CancellationToken.None)); }
/// <summary> /// Adds the specified WorkbookComment to the collection via POST. /// </summary> /// <param name="workbookComment">The WorkbookComment to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created WorkbookComment.</returns> public System.Threading.Tasks.Task <WorkbookComment> AddAsync(WorkbookComment workbookComment, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <WorkbookComment>(workbookComment, cancellationToken)); }
/// <summary> /// Adds the specified WorkbookComment to the collection via POST. /// </summary> /// <param name="workbookComment">The WorkbookComment to add.</param> /// <returns>The created WorkbookComment.</returns> public System.Threading.Tasks.Task <WorkbookComment> AddAsync(WorkbookComment workbookComment) { return(this.AddAsync(workbookComment, CancellationToken.None)); }