コード例 #1
0
        /// <summary>
        /// Updates the specified Ediscovery using PATCH.
        /// </summary>
        /// <param name="ediscoveryToUpdate">The Ediscovery 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 Ediscovery.</returns>
        public async System.Threading.Tasks.Task <Ediscovery> UpdateAsync(Ediscovery ediscoveryToUpdate, CancellationToken cancellationToken)
        {
            if (ediscoveryToUpdate.AdditionalData != null)
            {
                if (ediscoveryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    ediscoveryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, ediscoveryToUpdate.GetType().Name)
                    });
                }
            }
            if (ediscoveryToUpdate.AdditionalData != null)
            {
                if (ediscoveryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    ediscoveryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, ediscoveryToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <Ediscovery>(ediscoveryToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
コード例 #2
0
        /// <summary>
        /// Creates the specified Ediscovery using POST.
        /// </summary>
        /// <param name="ediscoveryToCreate">The Ediscovery to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created Ediscovery.</returns>
        public async System.Threading.Tasks.Task <Ediscovery> CreateAsync(Ediscovery ediscoveryToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <Ediscovery>(ediscoveryToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
コード例 #3
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="ediscoveryToInitialize">The <see cref="Ediscovery"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(Ediscovery ediscoveryToInitialize)
        {
            if (ediscoveryToInitialize != null && ediscoveryToInitialize.AdditionalData != null)
            {
                if (ediscoveryToInitialize.Cases != null && ediscoveryToInitialize.Cases.CurrentPage != null)
                {
                    ediscoveryToInitialize.Cases.AdditionalData = ediscoveryToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        ediscoveryToInitialize.Cases.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Creates the specified Ediscovery using POST.
 /// </summary>
 /// <param name="ediscoveryToCreate">The Ediscovery to create.</param>
 /// <returns>The created Ediscovery.</returns>
 public System.Threading.Tasks.Task <Ediscovery> CreateAsync(Ediscovery ediscoveryToCreate)
 {
     return(this.CreateAsync(ediscoveryToCreate, CancellationToken.None));
 }