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