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

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

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

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

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