Skip to content

Commit 6bf171d

Browse files
authored
Removed "/" from line .. ServerRelativeUrl (SharePoint#6370)
I have used the code in the section for "Add a sub-folder to a folder (.net)" but got "Server relative urls must start with SPWeb.ServerRelativeUrl" Exception. I changed the URL and removed the / at the beginning, and the code worked well.
1 parent 6535c8b commit 6bf171d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/solution-guidance/supporting-and-in-file-and-folder-with-the-resourcepath-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ The following C# properties are added to return System.Uri with unambiguous enco
140140
ClientContext context = new ClientContext("http://site");
141141
Web web = context.Web;
142142
// Get the parent folder
143-
ResourcePath folderPath = ResourcePath.FromDecodedUrl("/Shared Documents");
143+
ResourcePath folderPath = ResourcePath.FromDecodedUrl("Shared Documents");
144144
Folder parentFolder = web.GetFolderByServerRelativePath(folderPath);
145145

146146
// Create the parameters used to add a folder
147-
ResourcePath subFolderPath = ResourcePath.FromDecodedUrl("/Shared Documents/sub folder");
147+
ResourcePath subFolderPath = ResourcePath.FromDecodedUrl("Shared Documents/sub folder");
148148
FolderCollectionAddParameters folderAddParameters = new FolderCollectionAddParameters();
149149
folderAddParameters.Overwrite = true;
150150

0 commit comments

Comments
 (0)