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

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

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