public async Task <MultiRowEmail> SendRows(long?sheetId, IEnumerable <long> rowIds, IEnumerable <Recipient> sendTo, IEnumerable <long> columnIds, string subject = null, string message = null, bool ccMe = false, bool includeDiscussions = true, bool includeAttachments = true) { if (sheetId == null) { throw new Exception("Sheet ID cannot be null"); } if (rowIds.Count() == 0) { throw new Exception("Must specifiy 1 or more rows to update"); } if (sendTo.Count() == 0) { throw new Exception("Must specifiy 1 or more recipients"); } var multiRowEmail = new MultiRowEmail(); multiRowEmail.RowIds = rowIds.ToList(); multiRowEmail.ColumnIds = columnIds.ToList(); multiRowEmail.CcMe = ccMe; multiRowEmail.IncludeAttachments = includeAttachments; multiRowEmail.IncludeDiscussions = includeDiscussions; multiRowEmail.Subject = subject; multiRowEmail.Message = message; multiRowEmail.SendTo = sendTo.ToList(); var result = await this.ExecuteRequest <ResultResponse <MultiRowEmail>, MultiRowEmail>(HttpVerb.POST, string.Format("sheets/{0}/rows/emails", sheetId), multiRowEmail); return(result.Result); }
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); }
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); MultiRowEmail multiEmail = new MultiRowEmail { RowIds = rowIds, IncludeAttachments = true, IncludeDiscussions = true, CcMe = true, SendTo = new Recipient[] { new Recipient { Email = "*****@*****.**" } }, Subject = "hello", Message = "tada" }; UpdateRequest updateRequest = smartsheet.SheetResources.SendUpdateRequest(sheetId, multiEmail); 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); }
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); }
/// <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); }