Hot answers tagged

34

You cannot use the following characters in file/folder name: Tilde (~) Number sign (#) Percent (%) Ampersand (&) Asterisk (*) Braces ({ }) Backslash (\\) Colon (:) Angle brackets (< >) Question mark (?) Slash (/) Plus sign (+) Pipe (|) Quotation mark (") There are also restrictions about the positition of a character in a file/foldername: You ...


18

~, #, %, & , *, {, }, \, :, <, >, ?, /, |, “ above special character is not allowed for files/folder.. you need to replace these characters for create folder or files..


13

If you want to create a folder, you have to specify its name in the leafName parameter. change your code to : foreach (SPListItem reparto in reparti.Items) { var folder = dl.Items.Add( dl.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder, "Test" ); folder.Update(); } If it can help, here a ...


10

I solved this by using a CamlQuery directly after creation to return folders with the same name as a ListItemCollection: SP.CamlQuery query = new SP.CamlQuery(); query.ViewXml = "<View Scope='RecursiveAll'>" + "<Query>" + "<Where>" + "<And>" + "<Eq&...


10

This took forever to figure out, but of course it is simple once you got it. Instead of pasting a bunch of code, here is the context and then the raw HTTP POST request that I ended up with. The documentation is actually right here: http://msdn.microsoft.com/en-us/library/dd962796(v=office.12).aspx Syntax for the slug header is as following: /<...


9

How to create Folder (including nested) via CSOM in SharePoint /// <summary> /// Create Folder (including nested) client object /// </summary> /// <param name="web"></param> /// <param name="listTitle"></param> /// <param name="fullFolderPath"></param> /// <returns></returns> public static Folder ...


9

I would suggest you create different content type or use the tagging feature to organize the items. Check this for the list of Pros and Cons http://social.technet.microsoft.com/wiki/contents/articles/16166.sharepoint-2013-using-folders.aspx Folder vs Metadata SPS 2013 search makes it easy to find worthwhile files and list items with or without any added ...


8

Try not calling clientContext.Load, for example this works for me: var folder = list.RootFolder; clientContext.Load(folder); clientContext.ExecuteQuery(); folder = folder.Folders.Add("Folder 1"); folder.Folders.Add("Folder 2"); clientContext.ExecuteQuery();


7

The rules are "very simple" (see the full KB article here), which is why you should alway use SPUrlUtility to check filenames. Except about folders and files: Folder names •You cannot use the following characters anywhere in a folder name or a server name: ◦tilde ◦number sign ◦percent ◦ampersand ◦asterisk ◦braces ◦backslash ◦colon ◦...


7

If you want a super user to be able to change logos etc, or if the logo is specific to a site collection, place them in a subfolder in /Style Library/Images/. However often you dont want the layout files of your page, or your CSS for that matter, to be changed by end users. This is a good reason to place them somewhere in the v\TEMPLATE\LAYOUTSfolder. These ...


7

I know this is an old thread, but after spending a good while looking about I found an OOTB SharePoint Designer 2010 solution for this problem. To move a document to a different folder create an SPD2010 workflow and use the Update Item action to change the path and name of the document. After inserting the update list item action click on the "this list" ...


7

How to get current Folder client object via CSOM (JavaScript) function get_currentFolder(OnSuccess,OnError){ var context = SP.ClientContext.get_current(); var web = context.get_web(); var currentFolder = web.getFolderByServerRelativeUrl(decodeURIComponent(ctx.rootFolder)); context.load(currentFolder); context.executeQueryAsync( ...


7

See SharePoint Document Library List View Web Part with Clickable Breadcrumbs Excerpt from article: The first step is to create a text file that will contain the javascript necessary to generate the clickable breadcrumbs. I called my file LibraryViewBreadCrumbs.txt. Insert the following javascript text in to the file. <script type="text/...


7

Not to resurrect an old thread but I thought I would add my regex. One issue from KB905231 it is not clear if the prohibited file suffixes (i.e. .files or _files, etc.) are including or excluding the file extension. I assumed including so foo.doc.files would not match but foo.files.doc would. ^(?![\._]|.*(?:\.|\.files|_files|-Dateien|_fichiers|_bestanden|...


7

Run this code. I have taken "filename" as a folder - you can replace it with any folder name that you want. ClientContext cxt = new ClientContext("http://win-8c97ll22qqc:100/sites/dev"); List list = cxt.Web.Lists.GetByTitle("Documents"); cxt.Load(list); cxt.Load(list.RootFolder); cxt.Load(list.RootFolder.Folders); cxt.Load(list.RootFolder.Files); cxt....


7

You could utilize GetItems method and specify the following query: <View Scope="RecursiveAll"> <Query> <Where> <Eq> <FieldRef Name="FSObjType" /><Value Type="Integer">1</Value> </Eq> </Where> </Query> </View> to return all ...


7

Recently I answered a very similar question here. If you need all of the folders and subfolders (but no documents) recursively from a document library, that is what you should use (send it via POST to the server due to GetItems method call): /_api/web/Lists/GetByTitle('Title of your doc. lib.')/GetItems(query=@v1)?$expand=Folder&$select=Title,Folder/...


6

How about something like this: public static Folder EnsureFolder(ClientContext ctx, Folder ParentFolder, string FolderPath) { //Split up the incoming path so we have the first element as the a new sub-folder name //and add it to ParentFolder folders collection string[] PathElements = FolderPath.Split(new char[] { '/' }, ...


6

I added the recursive scope to the query and had success: SPQuery query = new SPQuery(); query.Folder = fldr; //Recursive Scope.... query.ViewAttributes = "Scope=\"Recursive\""; SPListItemCollection allitems = list.GetItems(query); int filecount = allitems.Count; Are there any better solutions?


6

The objects you get from $list.Folders are SPListItems not SPFolders so the ListItems property gives the Lists ListItemCollection not something for the folder. To get the SPFolder you have to access $folder.Folder. If what you're working with is a document library, then it's easy just access $folder.Folder.Files and you'll get the files in the SPFolder, ...


6

SP.Folder.name property is read-only and hence it could not be used in update operation. How to rename Folder using SharePoint 2013 REST The following example demonstrates how to rename Folder using SharePoint 2013 REST API: function executeJson(url,method,additionalHeaders,payload) { var headers = {}; headers["Accept"] = "application/json;odata=...


6

I found the solution myself and thought I would share the solution in case someone else encounters a similar challenge. By using the "Update Item" functionality in SPD you can assign the name of the folder to which you would like to move the document in the "Path and Name" field, simply by adding the foldername before the name of the file. (e.g. in my ...


6

You most likely mean a folder inside a document library, because you cannot add a folder to a site that is available for end-users. In order to add a folder inside a document library, you need to open up the ability to add a folder to the document library. Go to the document library where you want to add a folder Go to the Library Settings Advanced Settings ...


6

You can check if your item content type inherits from DocumentSet base content type that is 0x0120D520. Using C#: listItem.ContentTypeId.IsChildOf(new SPContentTypeId("0x0120D520")) or listItem.ContentTypeId.ToString().StartsWith("0x0120D520")


5

For SPQuery, use SPQuery.Folder to define the folder: SPFolder folder = list.RootFolder.SubFolders["Folder 1"]; SPQuery query = new SPQuery(); query.Folder = folder; Then, to define content type, you should include the following condition into your Where clause: SPContentType contentType = list.ContentTypes["MyContentType"]; query.Query = "<Where>&...


5

SharePoint doesn't support multiple versions of folders in Lists and Libraries.


5

Use windows explorer, in 2010/2013 it's found on the library tab of the library (and only works in IE on windows)


5

Set the DocumentSet.Folder.Item.ProgId to "SharePoint.DocumentSet". Right now it will be empty. See this for more information: http://www.sharepointnadeem.com/2011/08/sharepoint-2010-document-sets.html UPDATE Here is the sample PowerShell code. I haven't however tested it: $web = Get-SPWeb http://yoursite $list = $web.Lists["YourList"] $docSetName = "...


5

here is the Create folder command: New-Item "C:\Shared" –type directory If you are creating multiple levels at once (like "C:\NewRootFolder\NewChildFolder\NewShared" you can add the –force switch to make it create all necessary parent folders in the heirarchy) Now that you have a folder that you want to share, you can turn it into a shared folder using ...


5

Folders are items as well. Just get the item and load the folder property. using (var ctx = new ClientContext(Constants.SharePointUri)) { var list = ctx.Site.RootWeb.Lists.GetByTitle(Constants.Lists.Event.Name); var item = list.GetItemById(eventId); ctx.Load(list, d => d.Title, d => d.RootFolder.Name, d => d.Id); ctx.Load(item, d =&...


Only top voted, non community-wiki answers of a minimum length are eligible