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