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

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Пример #5
0
 /// <summary>
 /// Adds the specified DeviceManagementScriptAssignment to the collection via POST.
 /// </summary>
 /// <param name="deviceManagementScriptAssignment">The DeviceManagementScriptAssignment to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created DeviceManagementScriptAssignment.</returns>
 public System.Threading.Tasks.Task <DeviceManagementScriptAssignment> AddAsync(DeviceManagementScriptAssignment deviceManagementScriptAssignment, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <DeviceManagementScriptAssignment>(deviceManagementScriptAssignment, cancellationToken));
 }
Пример #6
0
 /// <summary>
 /// Adds the specified DeviceManagementScriptAssignment to the collection via POST.
 /// </summary>
 /// <param name="deviceManagementScriptAssignment">The DeviceManagementScriptAssignment to add.</param>
 /// <returns>The created DeviceManagementScriptAssignment.</returns>
 public System.Threading.Tasks.Task <DeviceManagementScriptAssignment> AddAsync(DeviceManagementScriptAssignment deviceManagementScriptAssignment)
 {
     return(this.AddAsync(deviceManagementScriptAssignment, CancellationToken.None));
 }