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

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

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

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

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