Example #1
0
 /// <summary>
 /// Adds the specified MultiValueLegacyExtendedProperty to the collection via POST.
 /// </summary>
 /// <param name="multiValueLegacyExtendedProperty">The MultiValueLegacyExtendedProperty to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created MultiValueLegacyExtendedProperty.</returns>
 public System.Threading.Tasks.Task <MultiValueLegacyExtendedProperty> AddAsync(MultiValueLegacyExtendedProperty multiValueLegacyExtendedProperty, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <MultiValueLegacyExtendedProperty>(multiValueLegacyExtendedProperty, cancellationToken));
 }
Example #2
0
 /// <summary>
 /// Adds the specified MultiValueLegacyExtendedProperty to the collection via POST.
 /// </summary>
 /// <param name="multiValueLegacyExtendedProperty">The MultiValueLegacyExtendedProperty to add.</param>
 /// <returns>The created MultiValueLegacyExtendedProperty.</returns>
 public System.Threading.Tasks.Task <MultiValueLegacyExtendedProperty> AddAsync(MultiValueLegacyExtendedProperty multiValueLegacyExtendedProperty)
 {
     return(this.AddAsync(multiValueLegacyExtendedProperty, CancellationToken.None));
 }
        /// <summary>
        /// Creates the specified MultiValueLegacyExtendedProperty using POST.
        /// </summary>
        /// <param name="multiValueLegacyExtendedPropertyToCreate">The MultiValueLegacyExtendedProperty to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created MultiValueLegacyExtendedProperty.</returns>
        public async System.Threading.Tasks.Task <MultiValueLegacyExtendedProperty> CreateAsync(MultiValueLegacyExtendedProperty multiValueLegacyExtendedPropertyToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <MultiValueLegacyExtendedProperty>(multiValueLegacyExtendedPropertyToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Creates the specified MultiValueLegacyExtendedProperty using POST.
 /// </summary>
 /// <param name="multiValueLegacyExtendedPropertyToCreate">The MultiValueLegacyExtendedProperty to create.</param>
 /// <returns>The created MultiValueLegacyExtendedProperty.</returns>
 public System.Threading.Tasks.Task <MultiValueLegacyExtendedProperty> CreateAsync(MultiValueLegacyExtendedProperty multiValueLegacyExtendedPropertyToCreate)
 {
     return(this.CreateAsync(multiValueLegacyExtendedPropertyToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="multiValueLegacyExtendedPropertyToInitialize">The <see cref="MultiValueLegacyExtendedProperty"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(MultiValueLegacyExtendedProperty multiValueLegacyExtendedPropertyToInitialize)
 {
 }
        /// <summary>
        /// Updates the specified MultiValueLegacyExtendedProperty using PATCH.
        /// </summary>
        /// <param name="multiValueLegacyExtendedPropertyToUpdate">The MultiValueLegacyExtendedProperty 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 MultiValueLegacyExtendedProperty.</returns>
        public async System.Threading.Tasks.Task <MultiValueLegacyExtendedProperty> UpdateAsync(MultiValueLegacyExtendedProperty multiValueLegacyExtendedPropertyToUpdate, CancellationToken cancellationToken)
        {
            if (multiValueLegacyExtendedPropertyToUpdate.AdditionalData != null)
            {
                if (multiValueLegacyExtendedPropertyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    multiValueLegacyExtendedPropertyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, multiValueLegacyExtendedPropertyToUpdate.GetType().Name)
                    });
                }
            }
            if (multiValueLegacyExtendedPropertyToUpdate.AdditionalData != null)
            {
                if (multiValueLegacyExtendedPropertyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    multiValueLegacyExtendedPropertyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, multiValueLegacyExtendedPropertyToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <MultiValueLegacyExtendedProperty>(multiValueLegacyExtendedPropertyToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }