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

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

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