public void TestSheetUpdateRequestResources() { string accessToken = ConfigurationManager.AppSettings["accessToken"]; SmartsheetClient smartsheet = new SmartsheetBuilder().SetAccessToken(accessToken).Build(); long sheetId = CreateSheet(smartsheet); PaginatedResult<Column> columnsResult = smartsheet.SheetResources.ColumnResources.ListColumns(sheetId, null, null); long columnId = columnsResult.Data[0].Id.Value; Cell[] cellsToAdd = new Cell[] { new Cell.AddCellBuilder(columnId, true).SetValue("hello").SetStrict(false).Build() }; IList<long> rowIds = AddRows(smartsheet, sheetId, columnId, cellsToAdd); UpdateRequest updateReq = new UpdateRequest { RowIds = rowIds, IncludeAttachments = true, IncludeDiscussions = true, CcMe = true, SendTo = new Recipient[] { new Recipient { Email = "*****@*****.**" } }, Subject = "hello", Message = "tada" }; UpdateRequest updateRequest = smartsheet.SheetResources.UpdateRequestResources.CreateUpdateRequest(sheetId, updateReq); Assert.IsNotNull(updateRequest.Id); Sheet a = smartsheet.SheetResources.GetSheet(sheetId, new SheetLevelInclusion[] { SheetLevelInclusion.ROW_PERMALINK }, null, null, null, null, null, null); smartsheet.SheetResources.DeleteSheet(sheetId); }
/// <summary> /// <para>Creates an Update Request for the specified Row(s) within the Sheet. An email notification /// (containing a link to the update request) will be asynchronously sent to the specified recipient(s).</para> /// <para>It mirrors To the following Smartsheet REST API method: POST /sheets/{sheetId}/updaterequests</para> /// </summary> /// <param name="sheetId"> the sheetId </param> /// <param name="email"> the Email </param> /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception> /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception> /// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception> /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception> /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception> /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception> public virtual UpdateRequest CreateUpdateRequest(long sheetId, UpdateRequest updateRequest) { return this.CreateResource<RequestResult<UpdateRequest>, UpdateRequest>("sheets/" + sheetId + "/updaterequests", updateRequest).Result; }
/// <summary> /// <para>Changes the specified Update Request for the Sheet.</para> /// <para>It mirrors To the following Smartsheet REST API method: PUT /sheets/{sheetId}/updaterequests/{updateRequestId}</para> /// </summary> /// <param name="sheetId"> the sheet Id </param> /// <param name="updateRequest"> the UpdateRequest to update</param> /// <returns> the updated updateRequest </returns> /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception> /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception> /// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception> /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception> /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception> /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception> public virtual UpdateRequest UpdateUpdateRequest(long sheetId, UpdateRequest updateRequest) { return this.UpdateResource("sheets/" + sheetId + "/updaterequests/" + updateRequest.Id, typeof(UpdateRequest), updateRequest); }