public void TestSheetCopyResources() { string accessToken = ConfigurationManager.AppSettings["accessToken"]; SmartsheetClient smartsheet = new SmartsheetBuilder().SetAccessToken(accessToken).Build(); // Before // Sheet // Folder // After // Sheet // Folder-----SheetCopy long folderId = CreateFolderInHome(smartsheet, "Folder1"); long sheetId = CreateSheet(smartsheet); ContainerDestination destination = new ContainerDestination { DestinationId = folderId, DestinationType = DestinationType.FOLDER, NewName = "SheetCopy" }; Sheet newCopiedSheet = smartsheet.SheetResources.CopySheet(sheetId, destination, new SheetCopyInclusion[] { SheetCopyInclusion.ALL }); Assert.IsTrue(newCopiedSheet.Name == "SheetCopy"); long copiedSheetId = newCopiedSheet.Id.Value; Sheet copiedSheet = smartsheet.SheetResources.GetSheet(copiedSheetId, null, null, null, null, null, null, null); Assert.IsTrue(copiedSheet.Name == "SheetCopy"); DeleteFolders(smartsheet, folderId); smartsheet.SheetResources.DeleteSheet(sheetId); }
internal UspsContainer(string name, string uspsName, ContainerSize size, ContainerDestination destination) { UspsName = uspsName; Name = name; Size = size; Destination = destination; }
public void TestFolderCopyResources() { string accessToken = ConfigurationManager.AppSettings["accessToken"]; SmartsheetClient smartsheet = new SmartsheetBuilder().SetAccessToken(accessToken).Build(); // Before // Folder1-----SubFolder1 // Folder2 // After // Folder1-----SubFolder1 // Folder2-----SubFolder1Copy long createdFolderInHomeId1 = CreateFolderInHome(smartsheet, "Folder1"); long createdFolderInHomeId2 = CreateFolderInHome(smartsheet, "Folder2"); long createdFolderInFolderId = CreateFolderInFolder(smartsheet, createdFolderInHomeId1, "SubFolder1"); ContainerDestination destination = new ContainerDestination { DestinationId = createdFolderInHomeId2, DestinationType = DestinationType.FOLDER, NewName = "SubFolder1Copy" }; Folder newCopiedFolder = smartsheet.FolderResources.CopyFolder(createdFolderInFolderId, destination, new FolderCopyInclusion[] { FolderCopyInclusion.ALL }, new FolderRemapExclusion[] { FolderRemapExclusion.CELL_LINKS }); Assert.IsTrue(newCopiedFolder.Name == "SubFolder1Copy"); long copiedFolderId = newCopiedFolder.Id.Value; Folder copiedFolder = smartsheet.FolderResources.GetFolder(copiedFolderId, null); Assert.IsTrue(copiedFolder.Name == "SubFolder1Copy"); DeleteFolders(smartsheet, createdFolderInHomeId1, createdFolderInHomeId2); }
public void TestSheetMoveResources() { SmartsheetClient smartsheet = new SmartsheetBuilder().SetMaxRetryTimeout(30000).Build(); // Before // Sheet // Folder // After // // Folder-----SheetCopy long folderId = CreateFolderInHome(smartsheet, "Folder1"); long sheetId = CreateSheet(smartsheet); ContainerDestination destination = new ContainerDestination { DestinationId = folderId, DestinationType = DestinationType.FOLDER, //NewName = "hello" }; Sheet newMovedSheet = smartsheet.SheetResources.MoveSheet(sheetId, destination); Assert.IsTrue(newMovedSheet.Name == "new sheet"); long movedSheetId = newMovedSheet.Id.Value; Sheet movedSheet = smartsheet.SheetResources.GetSheet(movedSheetId, null, null, null, null, null, null, null); Assert.IsTrue(movedSheet.Name == "new sheet"); //Deleting the folder will also delete the sheet. DeleteFolders(smartsheet, folderId); }
public void TestWorkspaceCopyResources() { SmartsheetClient smartsheet = new SmartsheetBuilder().SetMaxRetryTimeout(30000).Build(); // Before // Workspace1 // Folder2 // After // Workspace1 // Folder2-----Workspace1Copy Workspace workspace = smartsheet.WorkspaceResources.CreateWorkspace(new Workspace.CreateWorkspaceBuilder("Workspace1").Build()); long workspaceId = workspace.Id.Value; ContainerDestination destination = new ContainerDestination { NewName = "Workspace1Copy" }; Workspace newCopiedWorkspace = smartsheet.WorkspaceResources.CopyWorkspace(workspaceId, destination, new WorkspaceCopyInclusion[] { WorkspaceCopyInclusion.ALL }, new WorkspaceRemapExclusion[] { WorkspaceRemapExclusion.CELL_LINKS }); Assert.IsTrue(newCopiedWorkspace.Name == "Workspace1Copy"); long copiedWorkspaceId = newCopiedWorkspace.Id.Value; Workspace copiedWorkspace = smartsheet.WorkspaceResources.GetWorkspace(copiedWorkspaceId, null, null); Assert.IsTrue(copiedWorkspace.Name == "Workspace1Copy"); smartsheet.WorkspaceResources.DeleteWorkspace(workspaceId); smartsheet.WorkspaceResources.DeleteWorkspace(copiedWorkspaceId); }
public void CopySight() { SmartsheetClient ss = HelperFunctions.SetupClient("Copy Sight"); ContainerDestination dest = new ContainerDestination(); dest.DestinationType = DestinationType.FOLDER; dest.DestinationId = 424; dest.NewName = "new sight"; Sight sight = ss.SightResources.CopySight(52, dest); }
/// <summary> /// <para>Creates a copy of the specified Sheet.</para> /// <para>It mirrors To the following Smartsheet REST API method:<br /> /// POST /sheets/{sheetId}/copy</para> /// </summary> /// <param name="sheetId"> the sheet Id </param> /// <param name="destination"> the destination to copy to </param> /// <param name="include"> the elements to copy. Note: Cell history will not be copied, regardless of which include parameter values are specified.</param> /// <returns> the created folder </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 Sheet CopySheet(long sheetId, ContainerDestination destination, IEnumerable <SheetCopyInclusion> include) { IDictionary <string, string> parameters = new Dictionary <string, string>(); if (include != null) { parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include)); } return(this.CreateResource <RequestResult <Sheet>, ContainerDestination>(QueryUtil.GenerateUrl("sheets/" + sheetId + "/copy", parameters), destination).Result); }
/// <summary> /// <para>Creates a copy of the specified Workspace.</para> /// <para>It mirrors to the following Smartsheet REST API method:<br /> /// POST /workspaces/{workspaceId}/copy</para> /// </summary> /// <param name="workspaceId"> the workspace Id </param> /// <param name="destination"> the destination to copy to </param> /// <param name="include"> the elements to copy. Note: Cell history will not be copied, regardless of which include parameter values are specified.</param> /// <param name="skipRemap"> the references to NOT re-map for the newly created folder /// <para> /// If "cellLinks" is specified in the skipRemap parameter value, the cell links within the newly created folder will continue to point to the original source sheets. /// If "reports" is specified in the skipRemap parameter value, the reports within the newly created folder will continue to point to the original source sheets. /// </para> /// </param> /// <returns> the created workspace </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 Workspace CopyWorkspace(long workspaceId, ContainerDestination destination, IEnumerable<WorkspaceCopyInclusion> include, IEnumerable<WorkspaceRemapExclusion> skipRemap) { IDictionary<string, string> parameters = new Dictionary<string, string>(); if (include != null) { parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include)); } if (skipRemap != null) { parameters.Add("skipRemap", QueryUtil.GenerateCommaSeparatedList(skipRemap)); } return this.CreateResource<RequestResult<Workspace>, ContainerDestination>(QueryUtil.GenerateUrl("workspaces/" + workspaceId + "/copy", parameters), destination).Result; }
/// <summary> /// <para>Creates a copy of the specified Folder.</para> /// <para>It mirrors To the following Smartsheet REST API method:<br /> /// POST /folders/{folderId}/copy</para> /// </summary> /// <param name="folderId"> the folder Id </param> /// <param name="destination"> the destination to copy to </param> /// <param name="include"> the elements to copy. Note: Cell history will not be copied, regardless of which include parameter values are specified.</param> /// <param name="skipRemap"> the references to NOT re-map for the newly created folder /// <para> /// If “cellLinks” is specified in the skipRemap parameter value, the cell links within the newly created folder will continue to point to the original source sheets. /// If “reports” is specified in the skipRemap parameter value, the reports within the newly created folder will continue to point to the original source sheets. /// </para> /// </param> /// <returns> the created folder </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 Folder CopyFolder(long folderId, ContainerDestination destination, IEnumerable <FolderCopyInclusion> include, IEnumerable <FolderRemapExclusion> skipRemap) { IDictionary <string, string> parameters = new Dictionary <string, string>(); if (include != null) { parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include)); } if (skipRemap != null) { parameters.Add("skipRemap", QueryUtil.GenerateCommaSeparatedList(skipRemap)); } return(this.CreateResource <RequestResult <Folder>, ContainerDestination>(QueryUtil.GenerateUrl("folders/" + folderId + "/copy", parameters), destination).Result); }
public string PredictRow(ContainerDestination containerDestination) { // Add input data var input = new ModelInput { ContainerContentType = containerDestination.Container.ContentType.ToString(), ContainerSize = containerDestination.Container.Size.ToString(), ContainerType = containerDestination.Container.ContainerType.ToString(), RouteNumber = containerDestination.Destination.RegionNumber }; // Load model and predict output of sample data ModelOutput result = ConsumeModel.PredictRow(input); return(result.Prediction.ToString()); }
private void TestMoveSheet() { Folder folder = CreateFolderHome(); Sheet sheet = smartsheet.SheetResources.CreateSheet(CreateSheetObject()); ContainerDestination destination = new ContainerDestination(); destination.DestinationType = DestinationType.FOLDER; destination.DestinationId = folder.Id; Sheet movedSheet = smartsheet.SheetResources.MoveSheet(sheet.Id.Value, destination); Assert.IsNotNull(movedSheet); DeleteSheet(movedSheet.Id.Value); DeleteFolder(folder.Id.Value); }
private void TestCopySheet() { Folder folder = CreateFolderHome(); ContainerDestination destination = new ContainerDestination(); destination.DestinationType = DestinationType.FOLDER; destination.DestinationId = folder.Id; destination.NewName = "CSharp SDK Copied Sheet"; Sheet sheet = smartsheet.SheetResources.CopySheet(newSheetHome.Id.Value, destination, new List <SheetCopyInclusion> { SheetCopyInclusion.ALL }); Assert.IsTrue(sheet.Name == "CSharp SDK Copied Sheet"); DeleteFolder(folder.Id.Value); }
public void TestFolderMoveResources() { string accessToken = ConfigurationManager.AppSettings["accessToken"]; SmartsheetClient smartsheet = new SmartsheetBuilder().SetAccessToken(accessToken).Build(); // Before // Folder1-----SubFolder1 // Folder2 // After // Folder1 // Folder2-----SubFolder1 long createdFolderInHomeId1 = CreateFolderInHome(smartsheet, "Folder1"); long createdFolderInHomeId2 = CreateFolderInHome(smartsheet, "Folder2"); long createdFolderInFolderId = CreateFolderInFolder(smartsheet, createdFolderInHomeId1, "SubFolder1"); ContainerDestination destination = new ContainerDestination { DestinationId = createdFolderInHomeId2, DestinationType = DestinationType.FOLDER, //NewName = "NotSupported" }; Folder newMovedFolder = smartsheet.FolderResources.MoveFolder(createdFolderInFolderId, destination); Assert.IsTrue(newMovedFolder.Name == "SubFolder1"); long movedFolderId = newMovedFolder.Id.Value; Folder movedFolder = smartsheet.FolderResources.GetFolder(movedFolderId, null); Assert.IsTrue(movedFolder.Name == "SubFolder1"); // Assert the Folder which use to contain the moved Folder is now empty. PaginatedResult <Folder> foldersResult = smartsheet.FolderResources.ListFolders(createdFolderInHomeId1, null); Assert.IsTrue(foldersResult.Data.Count == 0); DeleteFolders(smartsheet, createdFolderInHomeId1, createdFolderInHomeId2); }
public void TestWorkspaceCopyResources() { string accessToken = ConfigurationManager.AppSettings["accessToken"]; SmartsheetClient smartsheet = new SmartsheetBuilder().SetAccessToken(accessToken).Build(); // Before // Workspace1 // Folder2 // After // Workspace1 // Folder2-----Workspace1Copy Workspace workspace = smartsheet.WorkspaceResources.CreateWorkspace(new Workspace.CreateWorkspaceBuilder("Workspace1").Build()); long workspaceId = workspace.Id.Value; long createdFolderInHomeId2 = CreateFolderInHome(smartsheet, "Folder2"); ContainerDestination destination = new ContainerDestination { //DestinationId = createdFolderInHomeId2, //DestinationType = DestinationType.FOLDER, NewName = "Workspace1Copy" }; Folder newCopiedWorkspace = smartsheet.WorkspaceResources.CopyWorkspace(workspaceId, destination, new WorkspaceCopyInclusion[] { WorkspaceCopyInclusion.ALL }, new WorkspaceRemapExclusion[] { WorkspaceRemapExclusion.CELL_LINKS }); Assert.IsTrue(newCopiedWorkspace.Name == "Workspace1Copy"); long copiedWorkspaceId = newCopiedWorkspace.Id.Value; Workspace copiedWorkspace = smartsheet.WorkspaceResources.GetWorkspace(copiedWorkspaceId, null, null); Assert.IsTrue(copiedWorkspace.Name == "Workspace1Copy"); DeleteFolders(smartsheet, createdFolderInHomeId2); smartsheet.WorkspaceResources.DeleteWorkspace(workspaceId); }
public ShippingRoute CreateRandomShippingRoute(int numberOfContainrs) { RandomContainerGenerater randomContainerGenerater = new RandomContainerGenerater(); List <ContainerDestination> containerDestinations = new List <ContainerDestination>(); for (int x = 0; x < numberOfContainrs; x++) { var container = randomContainerGenerater.GetRandomContainer(); var destination = GetRandomDestination(); ContainerDestination containerDestination = new ContainerDestination() { Container = container, Destination = destination }; containerDestinations.Add(containerDestination); } var portSchedule = GeneratePortScheduleFromContainerDestinations(containerDestinations); return(new ShippingRoute(portSchedule, containerDestinations)); }
/// <summary> /// <para>Moves the specified Folder to another location.</para> /// <para>It mirrors To the following Smartsheet REST API method:<br /> /// POST /folders/{folderId}/move</para> /// </summary> /// <param name="folderId"> the folder Id </param> /// <param name="destination"> the destination to copy to </param> /// <returns> the moved folder </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 Folder MoveFolder(long folderId, ContainerDestination destination) { return this.CreateResource<RequestResult<Folder>, ContainerDestination>("folders/" + folderId + "/move", destination).Result; }
/// <summary> /// <para>Creates a copy of the specified Folder.</para> /// <para>It mirrors To the following Smartsheet REST API method:<br /> /// POST /folders/{folderId}/copy</para> /// </summary> /// <param name="folderId"> the folder Id </param> /// <param name="destination"> the destination to copy to </param> /// <param name="include"> the elements to copy. Note: Cell history will not be copied, regardless of which include parameter values are specified.</param> /// <param name="skipRemap"> the references to NOT re-map for the newly created folder /// <para> /// If “cellLinks” is specified in the skipRemap parameter value, the cell links within the newly created folder will continue to point to the original source sheets. /// If “reports” is specified in the skipRemap parameter value, the reports within the newly created folder will continue to point to the original source sheets. /// </para> /// </param> /// <returns> the created folder </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 Folder CopyFolder(long folderId, ContainerDestination destination, IEnumerable<FolderCopyInclusion> include, IEnumerable<FolderRemapExclusion> skipRemap) { IDictionary<string, string> parameters = new Dictionary<string, string>(); if (include != null) { parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include)); } if (skipRemap != null) { parameters.Add("skipRemap", QueryUtil.GenerateCommaSeparatedList(skipRemap)); } return this.CreateResource<RequestResult<Folder>, ContainerDestination>(QueryUtil.GenerateUrl("folders/" + folderId + "/copy", parameters), destination).Result; }
/// <summary> /// <para>Moves the specified Sight to a new location.</para> /// <para>Mirrors to the following Smartsheet REST API method:<br /> /// POST /sights/{sightId}/move</para> /// </summary> /// <param name="sightId"> the Sight Id </param> /// <param name="destination"> the destination to copy to </param> /// <returns> the moved Sight </returns> /// <exception cref="System.InvalidOperationException"> if any argument is null or an 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 Sight MoveSight(long sightId, ContainerDestination destination) { return(this.CreateResource <RequestResult <Sight>, ContainerDestination>("sights/" + sightId + "/move", destination).Result); }
/// <summary> /// <para>Moves the specified Folder to another location.</para> /// <para>It mirrors To the following Smartsheet REST API method:<br /> /// POST /folders/{folderId}/move</para> /// </summary> /// <param name="folderId"> the folder Id </param> /// <param name="destination"> the destination to copy to </param> /// <returns> the moved folder </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 Folder MoveFolder(long folderId, ContainerDestination destination) { return(this.CreateResource <RequestResult <Folder>, ContainerDestination>("folders/" + folderId + "/move", destination).Result); }
/// <summary> /// <para>Moves the specified sheet to a new location.</para> /// <para>It mirrors To the following Smartsheet REST API method:<br /> /// POST /sheets/{sheetId}/move</para> /// </summary> /// <param name="sheetId"> the sheet Id </param> /// <param name="destination"> the destination to copy to </param> /// <returns> the moved sheet </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 Sheet MoveSheet(long sheetId, ContainerDestination destination) { return(this.CreateResource <RequestResult <Sheet>, ContainerDestination>("sheets/" + sheetId + "/move", destination).Result); }