public void SharePointConnectorDelete2Test() { SharePointConnector spConnector = new SharePointConnector(TestCommon.CreateClientContext(), TestCommon.DevSiteUrl, testContainer); // upload file using (var fileStream = System.IO.File.OpenRead(@".\resources\office365.png")) { spConnector.SaveFileStream("blabla.png", String.Format("{0}/sub1/sub11", testContainerSecure), fileStream); } // delete the file spConnector.DeleteFile("blabla.png", String.Format("{0}/sub1/sub11", testContainerSecure)); // read the file using (var bytes = spConnector.GetFileStream("blabla.png", String.Format("{0}/sub1/sub11", testContainerSecure))) { Assert.IsNull(bytes); } // file will be deleted at end of test }
public void SharePointConnectorDeleteFromWebRootFolder() { SharePointConnector spConnector = new SharePointConnector(); spConnector.Parameters.Add(SharePointConnector.CONNECTIONSTRING, TestCommon.DevSiteUrl); spConnector.Parameters.Add(SharePointConnector.CLIENTCONTEXT, TestCommon.CreateClientContext()); // upload file using (var fileStream = System.IO.File.OpenRead(@".\resources\testdefault.aspx")) { spConnector.SaveFileStream("blabla.aspx", string.Empty, fileStream); } // delete the file spConnector.DeleteFile("blabla.aspx"); // read the file using (var bytes = spConnector.GetFileStream("blabla.aspx")) { Assert.IsNull(bytes); } }