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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Creates the specified GroupPolicyOperation using POST.
 /// </summary>
 /// <param name="groupPolicyOperationToCreate">The GroupPolicyOperation to create.</param>
 /// <returns>The created GroupPolicyOperation.</returns>
 public System.Threading.Tasks.Task <GroupPolicyOperation> CreateAsync(GroupPolicyOperation groupPolicyOperationToCreate)
 {
     return(this.CreateAsync(groupPolicyOperationToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="groupPolicyOperationToInitialize">The <see cref="GroupPolicyOperation"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(GroupPolicyOperation groupPolicyOperationToInitialize)
 {
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Adds the specified GroupPolicyOperation to the collection via POST.
 /// </summary>
 /// <param name="groupPolicyOperation">The GroupPolicyOperation to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created GroupPolicyOperation.</returns>
 public System.Threading.Tasks.Task <GroupPolicyOperation> AddAsync(GroupPolicyOperation groupPolicyOperation, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <GroupPolicyOperation>(groupPolicyOperation, cancellationToken));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Adds the specified GroupPolicyOperation to the collection via POST.
 /// </summary>
 /// <param name="groupPolicyOperation">The GroupPolicyOperation to add.</param>
 /// <returns>The created GroupPolicyOperation.</returns>
 public System.Threading.Tasks.Task <GroupPolicyOperation> AddAsync(GroupPolicyOperation groupPolicyOperation)
 {
     return(this.AddAsync(groupPolicyOperation, CancellationToken.None));
 }