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