Пример #1
0
        /// <summary>
        /// Issues the PATCH request.
        /// </summary>
        /// <param name="office365groupsactivitycounts">The Office365GroupsActivityCounts object set with the properties to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The task to await for async call.</returns>
        public async System.Threading.Tasks.Task <IReportRootGetOffice365GroupsActivityCountsCollectionPage> PatchAsync(Office365GroupsActivityCounts office365groupsactivitycounts,
                                                                                                                        CancellationToken cancellationToken)
        {
            this.Method = "PATCH";
            var response = await this.SendAsync <ReportRootGetOffice365GroupsActivityCountsCollectionResponse>(office365groupsactivitycounts, cancellationToken).ConfigureAwait(false);

            if (response != null && response.Value != null && response.Value.CurrentPage != null)
            {
                if (response.AdditionalData != null)
                {
                    response.Value.AdditionalData = response.AdditionalData;

                    object nextPageLink;
                    response.AdditionalData.TryGetValue("@odata.nextLink", out nextPageLink);

                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        response.Value.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                return(response.Value);
            }

            return(null);
        }
Пример #2
0
 /// <summary>
 /// Issues the PATCH request.
 /// </summary>
 /// <param name="office365groupsactivitycounts">The Office365GroupsActivityCounts object set with the properties to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <IReportRootGetOffice365GroupsActivityCountsCollectionPage> PatchAsync(Office365GroupsActivityCounts office365groupsactivitycounts)
 {
     return(this.PatchAsync(office365groupsactivitycounts, CancellationToken.None));
 }
Пример #3
0
        /// <summary>
        /// Creates the specified Office365GroupsActivityCounts using POST.
        /// </summary>
        /// <param name="office365GroupsActivityCountsToCreate">The Office365GroupsActivityCounts to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created Office365GroupsActivityCounts.</returns>
        public async System.Threading.Tasks.Task <Office365GroupsActivityCounts> CreateAsync(Office365GroupsActivityCounts office365GroupsActivityCountsToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <Office365GroupsActivityCounts>(office365GroupsActivityCountsToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Пример #4
0
 /// <summary>
 /// Creates the specified Office365GroupsActivityCounts using POST.
 /// </summary>
 /// <param name="office365GroupsActivityCountsToCreate">The Office365GroupsActivityCounts to create.</param>
 /// <returns>The created Office365GroupsActivityCounts.</returns>
 public System.Threading.Tasks.Task <Office365GroupsActivityCounts> CreateAsync(Office365GroupsActivityCounts office365GroupsActivityCountsToCreate)
 {
     return(this.CreateAsync(office365GroupsActivityCountsToCreate, CancellationToken.None));
 }
Пример #5
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="office365GroupsActivityCountsToInitialize">The <see cref="Office365GroupsActivityCounts"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(Office365GroupsActivityCounts office365GroupsActivityCountsToInitialize)
 {
 }
Пример #6
0
        /// <summary>
        /// Updates the specified Office365GroupsActivityCounts using PATCH.
        /// </summary>
        /// <param name="office365GroupsActivityCountsToUpdate">The Office365GroupsActivityCounts 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 Office365GroupsActivityCounts.</returns>
        public async System.Threading.Tasks.Task <Office365GroupsActivityCounts> UpdateAsync(Office365GroupsActivityCounts office365GroupsActivityCountsToUpdate, CancellationToken cancellationToken)
        {
            if (office365GroupsActivityCountsToUpdate.AdditionalData != null)
            {
                if (office365GroupsActivityCountsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    office365GroupsActivityCountsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, office365GroupsActivityCountsToUpdate.GetType().Name)
                    });
                }
            }
            if (office365GroupsActivityCountsToUpdate.AdditionalData != null)
            {
                if (office365GroupsActivityCountsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    office365GroupsActivityCountsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, office365GroupsActivityCountsToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <Office365GroupsActivityCounts>(office365GroupsActivityCountsToUpdate, cancellationToken).ConfigureAwait(false);

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