-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCreateFolder.rss
33 lines (27 loc) · 949 Bytes
/
CreateFolder.rss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
' Example:
' rs -i CreateFolder.rss -s http://localhost/ReportServer -v path="/Path/To/Folder/To/Create"
Public Sub Main()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
If path.StartsWith("/") Then
path = path.Substring(1)
End If
CreateFolder(path)
End Sub
Public Sub CreateFolder(ByVal folderPath as String)
Dim parentDirectoryName = System.IO.Path.GetDirectoryName(folderPath).Replace("\", "/")
Dim directoryName = System.IO.Path.GetFileName(folderPath)
if not parentDirectoryName = nothing then
CreateFolder(parentDirectoryName)
end if
Dim exists as Boolean = false
try
if rs.GetItemType("/" & folderPath) = ItemTypeEnum.Folder then
exists = true
end if
catch ex as exception
' Ignore
end try
if not exists then
rs.CreateFolder(directoryName, "/" & parentDirectoryName, Nothing)
end if
End Sub