示例#1
0
 /// <summary>
 /// Adds the specified ManagedDeviceMobileAppConfigurationAssignment to the collection via POST.
 /// </summary>
 /// <param name="managedDeviceMobileAppConfigurationAssignment">The ManagedDeviceMobileAppConfigurationAssignment to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created ManagedDeviceMobileAppConfigurationAssignment.</returns>
 public System.Threading.Tasks.Task <ManagedDeviceMobileAppConfigurationAssignment> AddAsync(ManagedDeviceMobileAppConfigurationAssignment managedDeviceMobileAppConfigurationAssignment, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <ManagedDeviceMobileAppConfigurationAssignment>(managedDeviceMobileAppConfigurationAssignment, cancellationToken));
 }
示例#2
0
 /// <summary>
 /// Adds the specified ManagedDeviceMobileAppConfigurationAssignment to the collection via POST.
 /// </summary>
 /// <param name="managedDeviceMobileAppConfigurationAssignment">The ManagedDeviceMobileAppConfigurationAssignment to add.</param>
 /// <returns>The created ManagedDeviceMobileAppConfigurationAssignment.</returns>
 public System.Threading.Tasks.Task <ManagedDeviceMobileAppConfigurationAssignment> AddAsync(ManagedDeviceMobileAppConfigurationAssignment managedDeviceMobileAppConfigurationAssignment)
 {
     return(this.AddAsync(managedDeviceMobileAppConfigurationAssignment, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="managedDeviceMobileAppConfigurationAssignmentToInitialize">The <see cref="ManagedDeviceMobileAppConfigurationAssignment"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ManagedDeviceMobileAppConfigurationAssignment managedDeviceMobileAppConfigurationAssignmentToInitialize)
 {
 }
        /// <summary>
        /// Creates the specified ManagedDeviceMobileAppConfigurationAssignment using POST.
        /// </summary>
        /// <param name="managedDeviceMobileAppConfigurationAssignmentToCreate">The ManagedDeviceMobileAppConfigurationAssignment to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created ManagedDeviceMobileAppConfigurationAssignment.</returns>
        public async System.Threading.Tasks.Task <ManagedDeviceMobileAppConfigurationAssignment> CreateAsync(ManagedDeviceMobileAppConfigurationAssignment managedDeviceMobileAppConfigurationAssignmentToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <ManagedDeviceMobileAppConfigurationAssignment>(managedDeviceMobileAppConfigurationAssignmentToCreate, cancellationToken).ConfigureAwait(false);

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

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