コード例 #1
0
        /// <summary>
        /// Updates the specified OnenoteOperation using PATCH.
        /// </summary>
        /// <param name="onenoteOperationToUpdate">The OnenoteOperation 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 OnenoteOperation.</returns>
        public async System.Threading.Tasks.Task <OnenoteOperation> UpdateAsync(OnenoteOperation onenoteOperationToUpdate, CancellationToken cancellationToken)
        {
            if (onenoteOperationToUpdate.AdditionalData != null)
            {
                if (onenoteOperationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    onenoteOperationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, onenoteOperationToUpdate.GetType().Name)
                    });
                }
            }
            if (onenoteOperationToUpdate.AdditionalData != null)
            {
                if (onenoteOperationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    onenoteOperationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, onenoteOperationToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <OnenoteOperation>(onenoteOperationToUpdate, cancellationToken).ConfigureAwait(false);

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

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