Beispiel #1
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="androidForWorkImportedPFXCertificateProfileToInitialize">The <see cref="AndroidForWorkImportedPFXCertificateProfile"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(AndroidForWorkImportedPFXCertificateProfile androidForWorkImportedPFXCertificateProfileToInitialize)
        {
            if (androidForWorkImportedPFXCertificateProfileToInitialize != null && androidForWorkImportedPFXCertificateProfileToInitialize.AdditionalData != null)
            {
                if (androidForWorkImportedPFXCertificateProfileToInitialize.ManagedDeviceCertificateStates != null && androidForWorkImportedPFXCertificateProfileToInitialize.ManagedDeviceCertificateStates.CurrentPage != null)
                {
                    androidForWorkImportedPFXCertificateProfileToInitialize.ManagedDeviceCertificateStates.AdditionalData = androidForWorkImportedPFXCertificateProfileToInitialize.AdditionalData;

                    object nextPageLink;
                    androidForWorkImportedPFXCertificateProfileToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        androidForWorkImportedPFXCertificateProfileToInitialize.ManagedDeviceCertificateStates.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates the specified AndroidForWorkImportedPFXCertificateProfile using POST.
        /// </summary>
        /// <param name="androidForWorkImportedPFXCertificateProfileToCreate">The AndroidForWorkImportedPFXCertificateProfile to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created AndroidForWorkImportedPFXCertificateProfile.</returns>
        public async System.Threading.Tasks.Task <AndroidForWorkImportedPFXCertificateProfile> CreateAsync(AndroidForWorkImportedPFXCertificateProfile androidForWorkImportedPFXCertificateProfileToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <AndroidForWorkImportedPFXCertificateProfile>(androidForWorkImportedPFXCertificateProfileToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Beispiel #3
0
 /// <summary>
 /// Creates the specified AndroidForWorkImportedPFXCertificateProfile using POST.
 /// </summary>
 /// <param name="androidForWorkImportedPFXCertificateProfileToCreate">The AndroidForWorkImportedPFXCertificateProfile to create.</param>
 /// <returns>The created AndroidForWorkImportedPFXCertificateProfile.</returns>
 public System.Threading.Tasks.Task <AndroidForWorkImportedPFXCertificateProfile> CreateAsync(AndroidForWorkImportedPFXCertificateProfile androidForWorkImportedPFXCertificateProfileToCreate)
 {
     return(this.CreateAsync(androidForWorkImportedPFXCertificateProfileToCreate, CancellationToken.None));
 }
Beispiel #4
0
        /// <summary>
        /// Updates the specified AndroidForWorkImportedPFXCertificateProfile using PATCH.
        /// </summary>
        /// <param name="androidForWorkImportedPFXCertificateProfileToUpdate">The AndroidForWorkImportedPFXCertificateProfile 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 AndroidForWorkImportedPFXCertificateProfile.</returns>
        public async System.Threading.Tasks.Task <AndroidForWorkImportedPFXCertificateProfile> UpdateAsync(AndroidForWorkImportedPFXCertificateProfile androidForWorkImportedPFXCertificateProfileToUpdate, CancellationToken cancellationToken)
        {
            if (androidForWorkImportedPFXCertificateProfileToUpdate.AdditionalData != null)
            {
                if (androidForWorkImportedPFXCertificateProfileToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    androidForWorkImportedPFXCertificateProfileToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, androidForWorkImportedPFXCertificateProfileToUpdate.GetType().Name)
                    });
                }
            }
            if (androidForWorkImportedPFXCertificateProfileToUpdate.AdditionalData != null)
            {
                if (androidForWorkImportedPFXCertificateProfileToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    androidForWorkImportedPFXCertificateProfileToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, androidForWorkImportedPFXCertificateProfileToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <AndroidForWorkImportedPFXCertificateProfile>(androidForWorkImportedPFXCertificateProfileToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }