/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="windowsAutopilotDeploymentProfileToInitialize">The <see cref="WindowsAutopilotDeploymentProfile"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(WindowsAutopilotDeploymentProfile windowsAutopilotDeploymentProfileToInitialize) { if (windowsAutopilotDeploymentProfileToInitialize != null && windowsAutopilotDeploymentProfileToInitialize.AdditionalData != null) { if (windowsAutopilotDeploymentProfileToInitialize.AssignedDevices != null && windowsAutopilotDeploymentProfileToInitialize.AssignedDevices.CurrentPage != null) { windowsAutopilotDeploymentProfileToInitialize.AssignedDevices.AdditionalData = windowsAutopilotDeploymentProfileToInitialize.AdditionalData; object nextPageLink; windowsAutopilotDeploymentProfileToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { windowsAutopilotDeploymentProfileToInitialize.AssignedDevices.InitializeNextPageRequest( this.Client, nextPageLinkString); } } if (windowsAutopilotDeploymentProfileToInitialize.Assignments != null && windowsAutopilotDeploymentProfileToInitialize.Assignments.CurrentPage != null) { windowsAutopilotDeploymentProfileToInitialize.Assignments.AdditionalData = windowsAutopilotDeploymentProfileToInitialize.AdditionalData; object nextPageLink; windowsAutopilotDeploymentProfileToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { windowsAutopilotDeploymentProfileToInitialize.Assignments.InitializeNextPageRequest( this.Client, nextPageLinkString); } } } }
/// <summary> /// Updates the specified WindowsAutopilotDeploymentProfile using PATCH. /// </summary> /// <param name="windowsAutopilotDeploymentProfileToUpdate">The WindowsAutopilotDeploymentProfile to update.</param> /// <returns>The updated WindowsAutopilotDeploymentProfile.</returns> public System.Threading.Tasks.Task <WindowsAutopilotDeploymentProfile> UpdateAsync(WindowsAutopilotDeploymentProfile windowsAutopilotDeploymentProfileToUpdate) { return(this.UpdateAsync(windowsAutopilotDeploymentProfileToUpdate, CancellationToken.None)); }
/// <summary> /// Creates the specified WindowsAutopilotDeploymentProfile using POST. /// </summary> /// <param name="windowsAutopilotDeploymentProfileToCreate">The WindowsAutopilotDeploymentProfile to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created WindowsAutopilotDeploymentProfile.</returns> public async System.Threading.Tasks.Task <WindowsAutopilotDeploymentProfile> CreateAsync(WindowsAutopilotDeploymentProfile windowsAutopilotDeploymentProfileToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <WindowsAutopilotDeploymentProfile>(windowsAutopilotDeploymentProfileToCreate, cancellationToken).ConfigureAwait(false); return(newEntity); }
/// <summary> /// Updates the specified WindowsAutopilotDeploymentProfile using PATCH. /// </summary> /// <param name="windowsAutopilotDeploymentProfileToUpdate">The WindowsAutopilotDeploymentProfile 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 WindowsAutopilotDeploymentProfile.</returns> public async System.Threading.Tasks.Task <WindowsAutopilotDeploymentProfile> UpdateAsync(WindowsAutopilotDeploymentProfile windowsAutopilotDeploymentProfileToUpdate, CancellationToken cancellationToken) { if (windowsAutopilotDeploymentProfileToUpdate.AdditionalData != null) { if (windowsAutopilotDeploymentProfileToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || windowsAutopilotDeploymentProfileToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsAutopilotDeploymentProfileToUpdate.GetType().Name) }); } } if (windowsAutopilotDeploymentProfileToUpdate.AdditionalData != null) { if (windowsAutopilotDeploymentProfileToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || windowsAutopilotDeploymentProfileToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsAutopilotDeploymentProfileToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <WindowsAutopilotDeploymentProfile>(windowsAutopilotDeploymentProfileToUpdate, cancellationToken).ConfigureAwait(false); return(updatedEntity); }
public AutopilotConfiguration(Microsoft.Graph.WindowsAutopilotDeploymentProfile profile, Microsoft.Graph.Organization organization) { Comment_File = "Offline Autopilot Profile " + profile.DisplayName; Version = 2049; ZtdCorrelationId = profile.Id; if (profile.ODataType.Equals("#microsoft.graph.activeDirectoryWindowsAutopilotDeploymentProfile")) { CloudAssignedDomainJoinMethod = 1; } else { CloudAssignedDomainJoinMethod = 0; } if (profile.DeviceNameTemplate.Length > 0) { CloudAssignedDeviceName = profile.DeviceNameTemplate; } CloudAssignedOobeConfig = 8 + 256; if (profile.OutOfBoxExperienceSettings.UserType.Equals("standard")) { CloudAssignedOobeConfig += 2; } if ((bool)profile.OutOfBoxExperienceSettings.HidePrivacySettings) { CloudAssignedOobeConfig += 4; } if ((bool)profile.OutOfBoxExperienceSettings.HideEULA) { CloudAssignedOobeConfig += 16; } if ((bool)profile.OutOfBoxExperienceSettings.SkipKeyboardSelectionPage) { CloudAssignedOobeConfig += 1024; } if (profile.OutOfBoxExperienceSettings.DeviceUsageType.Equals("shared")) { CloudAssignedOobeConfig += 32 + 64; } if (profile.Language.Length > 0) { CloudAssignedLanguage = profile.Language; } if ((bool)profile.OutOfBoxExperienceSettings.HideEscapeLink) { CloudAssignedForcedEnrollment = 1; } else { CloudAssignedForcedEnrollment = 0; } CloudAssignedTenantId = organization.Id; foreach (VerifiedDomain domain in organization.VerifiedDomains) { if ((bool)domain.IsDefault) { CloudAssignedTenantDomain = domain.Name; } } int hideEscapeLink = 0; if (profile.OutOfBoxExperienceSettings.HideEscapeLink.HasValue) { hideEscapeLink = 1; } // Nest a ZeroTouchConfig within the CloudAssignedAadServerData object -> required for the JSON ZeroTouchConfig touchConfig = new ZeroTouchConfig(CloudAssignedTenantDomain, hideEscapeLink); CloudAssignedAadServerData zeroTouchConfig = new CloudAssignedAadServerData(touchConfig); // Serialize ZeroTouchConfig as JSON string this.CloudAssignedAadServerData = JsonConvert.SerializeObject(zeroTouchConfig, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore } ); }
/// <summary> /// Adds the specified WindowsAutopilotDeploymentProfile to the collection via POST. /// </summary> /// <param name="windowsAutopilotDeploymentProfile">The WindowsAutopilotDeploymentProfile to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created WindowsAutopilotDeploymentProfile.</returns> public System.Threading.Tasks.Task <WindowsAutopilotDeploymentProfile> AddAsync(WindowsAutopilotDeploymentProfile windowsAutopilotDeploymentProfile, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; windowsAutopilotDeploymentProfile.ODataType = string.Concat("#", StringHelper.ConvertTypeToLowerCamelCase(windowsAutopilotDeploymentProfile.GetType().FullName)); return(this.SendAsync <WindowsAutopilotDeploymentProfile>(windowsAutopilotDeploymentProfile, cancellationToken)); }