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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Example #3
0
 /// <summary>
 /// Adds the specified CaseOperation to the collection via POST.
 /// </summary>
 /// <param name="caseOperation">The CaseOperation to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created CaseOperation.</returns>
 public System.Threading.Tasks.Task <CaseOperation> AddAsync(CaseOperation caseOperation, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <CaseOperation>(caseOperation, cancellationToken));
 }
Example #4
0
 /// <summary>
 /// Adds the specified CaseOperation to the collection via POST.
 /// </summary>
 /// <param name="caseOperation">The CaseOperation to add.</param>
 /// <returns>The created CaseOperation.</returns>
 public System.Threading.Tasks.Task <CaseOperation> AddAsync(CaseOperation caseOperation)
 {
     return(this.AddAsync(caseOperation, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified CaseOperation using POST.
 /// </summary>
 /// <param name="caseOperationToCreate">The CaseOperation to create.</param>
 /// <returns>The created CaseOperation.</returns>
 public System.Threading.Tasks.Task <CaseOperation> CreateAsync(CaseOperation caseOperationToCreate)
 {
     return(this.CreateAsync(caseOperationToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="caseOperationToInitialize">The <see cref="CaseOperation"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(CaseOperation caseOperationToInitialize)
 {
 }