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