From 481c287011e922417ef29e7c7539ee1bcccd0823 Mon Sep 17 00:00:00 2001 From: Nicholas DiPiazza Date: Fri, 18 Sep 2020 12:45:46 -0500 Subject: [PATCH] rename folder --- README.md | 18 +++++++++++++++++- .../SharepointTestUtilityDotnet/Program.cs | 16 ++++++++-------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5d30651..91a1d47 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,18 @@ # sputil-docker -Dockerbuild for an SP utilility +Dockerbuild for an SP utility + + +# how to publish a new version + +Merge your change. Create a tag. + +run `docker build .` from the root directory. It will publish the tag to docker. + +The result, you can then use the new docker image: + +Example: + +`ndipiazza/sputil_mono:0.0.4` + + + diff --git a/sharepoint-test-utility-dotnet/SharepointTestUtilityDotnet/Program.cs b/sharepoint-test-utility-dotnet/SharepointTestUtilityDotnet/Program.cs index da4644d..537d8fb 100644 --- a/sharepoint-test-utility-dotnet/SharepointTestUtilityDotnet/Program.cs +++ b/sharepoint-test-utility-dotnet/SharepointTestUtilityDotnet/Program.cs @@ -203,14 +203,6 @@ class Program { string password; List> actions; - public static void RenameFile(ClientContext ctx, string fileUrl, string newName) { - var file = ctx.Web.GetFileByServerRelativeUrl(fileUrl); - ctx.Load(file.ListItemAllFields); - ctx.ExecuteQuery(); - file.MoveTo(file.ListItemAllFields["FileDirRef"] + "/" + newName, MoveOperations.Overwrite); - ctx.ExecuteQuery(); - } - static SecureString GetSecureString(string input) { if (string.IsNullOrEmpty(input)) throw new ArgumentException("Input string is empty and cannot be made into a SecureString", nameof(input)); @@ -569,6 +561,14 @@ void exec() { res.Add("" + item.Id); } + } else if (actionType.Equals("renameFolder")) { + using (ClientContext clientContext = getClientContext(removeHttpsFromUrl((string)action["ParentSiteUrl"]))) { + var from = (string)action["FromFolderUrl"]; + var to = (string)action["ToFolderUrl"]; + var folder = clientContext.Web.GetFolderByServerRelativeUrl(from); + folder.MoveTo(to); + clientContext.ExecuteQuery(); + } } else if (actionType.Equals("moveFiles")) { using (ClientContext clientContext = getClientContext(removeHttpsFromUrl((string)action["ParentSiteUrl"]))) { // FromFolderUrl and ToFolderUrl are ServerRelativePaths such as /sites/nick_test/Shared Documents/test1