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