public void TestRowDeleteSendResources() { string accessToken = ConfigurationManager.AppSettings["accessToken"]; SmartsheetClient smartsheet = new SmartsheetBuilder().SetAccessToken(accessToken).Build(); long templateId = smartsheet.TemplateResources.ListPublicTemplates(null).Data[0].Id.Value; long sheetId = CreateSheetFromTemplate(smartsheet, templateId); 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); MultiRowEmail multiEmail = new MultiRowEmail { RowIds = rowIds, IncludeAttachments = true, IncludeDiscussions = true, SendTo = new Recipient[] { new Recipient { Email = "*****@*****.**" } }, Subject = "hello", Message = "tada" }; smartsheet.SheetResources.RowResources.SendRows(sheetId, multiEmail); DeleteRows(smartsheet, sheetId, rowIds); smartsheet.SheetResources.DeleteSheet(sheetId); }
private static void SendRows(SmartsheetClient smartsheet, long sheetId, long columnId, long rowId) { MultiRowEmail multiRowEmail = new MultiRowEmail { SendTo = new Recipient[] { new Recipient { Email = "*****@*****.**" } }, Subject = "some subject", Message = "some message", CcMe = false, RowIds = new long[] { rowId }, ColumnIds = new long[] { columnId }, IncludeAttachments = false, IncludeDiscussions = false }; smartsheet.SheetResources.RowResources.SendRows(sheetId, multiRowEmail); }
/// <summary> /// <para>Sends one or more Rows via email.</para> /// <para>It mirrors To the following Smartsheet REST API method: POST /sheets/{sheetId}/rows/emails</para> /// </summary> /// <param name="sheetId"> The sheet Id </param> /// <param name="email"> The email. The columns included for each row in the email will be populated according to the following rules: /// <list type="bullet"> /// <item><description> /// If the columnIds attribute of the MultiRowEmail object is specified as an array of column IDs, those specific columns will be included. /// </description></item> /// <item><description> /// If the columnIds attribute of the MultiRowEmail object is omitted, all columns except hidden columns shall be included. /// </description></item> /// <item><description> /// If the columnIds attribute of the MultiRowEmail object is specified as empty, no columns shall be included. /// (Note: In this case, either includeAttachments:true or includeDiscussions:true must be specified.) /// </description></item> /// </list> /// </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 void SendRows(long sheetId, MultiRowEmail email) { this.CreateResource<MultiRowEmail>("sheets/" + sheetId + "/rows/emails", typeof(MultiRowEmail), email); }
/// <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 SendUpdateRequest(long sheetId, MultiRowEmail email) { return this.CreateResource<RequestResult<UpdateRequest>, MultiRowEmail>("sheets/" + sheetId + "/updaterequests", email).Result; }