/// <summary>
        /// Issues the PATCH request.
        /// </summary>
        /// <param name="sharepointsiteusagepages">The SharePointSiteUsagePages 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 <IReportRootGetSharePointSiteUsagePagesCollectionPage> PatchAsync(SharePointSiteUsagePages sharepointsiteusagepages,
                                                                                                                   CancellationToken cancellationToken)
        {
            this.Method = "PATCH";
            var response = await this.SendAsync <ReportRootGetSharePointSiteUsagePagesCollectionResponse>(sharepointsiteusagepages, 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);
        }
 /// <summary>
 /// Issues the PATCH request.
 /// </summary>
 /// <param name="sharepointsiteusagepages">The SharePointSiteUsagePages object set with the properties to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <IReportRootGetSharePointSiteUsagePagesCollectionPage> PatchAsync(SharePointSiteUsagePages sharepointsiteusagepages)
 {
     return(this.PatchAsync(sharepointsiteusagepages, CancellationToken.None));
 }
예제 #3
0
        /// <summary>
        /// Creates the specified SharePointSiteUsagePages using POST.
        /// </summary>
        /// <param name="sharePointSiteUsagePagesToCreate">The SharePointSiteUsagePages to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created SharePointSiteUsagePages.</returns>
        public async System.Threading.Tasks.Task <SharePointSiteUsagePages> CreateAsync(SharePointSiteUsagePages sharePointSiteUsagePagesToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <SharePointSiteUsagePages>(sharePointSiteUsagePagesToCreate, cancellationToken).ConfigureAwait(false);

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

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