Group by folder name in sharepoint library
Hi
Is there any way to group the items based on Folder name in sharepoint Document Library.
keerthi
Hi keerthi,
I agree with pkozan. We can use workflow to exact the folder name from an item, and populate it in a custom column. After than, we can group the items by the custom column.
In the workflow, we can set the Item's Path value to the custom column.
But here, I would like to propose another solution. We can use the SharePoint treeview control. With the Treeview control, all folders will be displayed in the tree, then we can display item with a folder by clicking the folder name, without go back to the
page again.
For more detailed on this solution, please see:
http://yetanothersharepointblog.wordpress.com/2012/08/28/adding-a-treeview-to-a-document-library-using-sptreeview-and-sphierarchicaldatasource/
Thanks,
Jinchun Chen
Jinchun Chen(JC)
TechNet Community Support
Similar Messages
-
Creating a new folder in a SharePoint library using C# Windows Application.
I have tried to create a folder within a SharePoint document library. The coding is as follows.
Text Box Name: txtNewFolderName
Button Name : btnCreateNewFolder
private void btnCreateNewFolder_Click(object sender, EventArgs e)
//String parameters for site URL and site name
const string siteUrl = "http://thekingsbury/";
const string siteName = "/SiteDirectory/thekingsbury/";
//Freeze UI
Cursor = Cursors.WaitCursor;
btnCreateNewFolder.Enabled = false;
//Use SPSite constructor to assign site collection based on top-level URL
SPSite siteCollection = new SPSite(siteUrl);
//Assign target site (SPWeb instance) based on site name
SPWeb site = siteCollection.AllWebs[siteName];
//Create an instance of SPDocumentLibrary based on the named doc library list
SPDocumentLibrary docLibrary = (SPDocumentLibrary)site.Lists["Test Library"];
//Create instance of SPFolderCollection and add a named folder based on forms input,
//then update library to reflect added folder
SPFolderCollection myFolders = site.Folders;
myFolders.Add("http://thekingsbury/Test%20Library/" + txtNewFolderName.Text + "/");
docLibrary.Update();
//UI clean-up
Cursor = Cursors.Default;
btnCreateNewFolder.Enabled = true;
Site URL :
http://thekingsbury/
Site Name: thekingsbury
Document Library : Test Library
My problem is when I click the button it gives an error as the following.
The Web application at http://thekingsbury/ could not be found.
Verify that you have typed the URL correctly.
If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
The error shows at the following statement.
"SPSite siteCollection = new SPSite(siteUrl);"
I created both Windows & Web solutions and the result was the same.
Note: I have add the reference to the SharePoint using the Microsoft.SharePoint.dll file. And used the "using Microsoft.SharePoint;" statement.
Please can someone help me on this matter.It's a real paint to me.The complete solution using an InfoPath 2010 form is as the below.
using Microsoft.Office.InfoPath;
using System;
using System.Xml;
using System.Xml.XPath;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Linq;
namespace Create_Folder_In_SharePoint_Library
public partial class FormCode
public void InternalStartup()
((ButtonEvent)EventManager.ControlEvents["btnCreateFolder"]).Clicked += new ClickedEventHandler(btnCreateFolder_Clicked);
public void btnCreateFolder_Clicked(object sender, ClickedEventArgs e)
SPSite mySite = new SPSite("Http://thekingsbury/");
SPWeb myWeb = mySite.OpenWeb();
//Code to retreive the new library.
XPathNavigator xLibraryName = MainDataSource.CreateNavigator();
String NewLibraryName = xLibraryName.SelectSingleNode("/my:myFields/my:LibraryName", NamespaceManager).Value;
//Code to retreive the library description.
XPathNavigator xLibraryDesc = MainDataSource.CreateNavigator();
String NewLibDesc = xLibraryDesc.SelectSingleNode("/my:myFields/my:LibraryDescription", NamespaceManager).Value;
//Code to retreive the new folder name.
XPathNavigator xFolderName = MainDataSource.CreateNavigator();
String NewFolderName = xFolderName.SelectSingleNode("/my:myFields/my:FolderName", NamespaceManager).Value;
//Creating the new library.
myWeb.Lists.Add(NewLibraryName, NewLibDesc, SPListTemplateType.DocumentLibrary);
myWeb.Update();
//Creating the new folder within the new library.
SPDocumentLibrary newDocLibrary = (SPDocumentLibrary)myWeb.Lists[NewLibraryName];
SPFolderCollection newFolders = myWeb.Folders;
newFolders.Add("http://thekingsbury/" + NewLibraryName + "/" + NewFolderName + "/");
newDocLibrary.Update();
I think everyone can use this.
When you are generating a folder always try to avoid reserved characters : ; # $ % ^ a and suchlike. -
How to add folder name to document library view
Using Project Server 2010.
We have a set of standard folders on each of our project sites for Requirements, Development, Testing, etc. Currently, we display this library like you would see in File Explorer - you see a list of folders at the top, double-click on a folder
to drill down, etc.
I want to display these same documents as a straight list of all documents - not grouped into folders - but with the folder name displayed next to it (sort of like an attribute). I can create the list view easily by selecting the "Show all items
without folders" option in the view settings; however, the containing folder name is not available as a column name.
Is this possible?I do not think there is an out of the box way to do this.
The immediate solution that comes to mind is using a workflow, that runs everytime a document is uploaded/item created, which may be too much for your scenario.
Cheers,
Prasanna Adavi, Project MVP
Blog:
Podcast:
Twitter:
LinkedIn:
-
How to find list or folder name from SharePoint document URL
I'm implementing the SharePoint client object model in my VSTO application in .NET framework 4.0(C#).
Actually we open MS Word files from SharePoint site, we need to create a folder inside the opened documents list/folder and after it we want to upload/add some files to that created folder.
My problem is that how to get list name/title and folder name of opened document by using the documents URL or Is there an another option to find the list or folder name of opened document.
Any help will be appreciable.In document Library you can get the name of document library directly in URL. for folder name you can try below:
using System;
using Microsoft.SharePoint;
namespace Test
class ConsoleApp
static void Main(string[] args)
using (SPSite site = new SPSite("http://localhost"))
using (SPWeb web = site.OpenWeb())
if (web.DoesUserHavePermissions(SPBasePermissions.BrowseDirectories))
// Get a folder by server-relative URL.
string url = web.ServerRelativeUrl + "/shared documents/test folder";
SPFolder folder = web.GetFolder(url);
try
// Get the folder's Guid.
Guid id = folder.UniqueId;
Console.WriteLine(id);
// Get a folder by Guid.
folder = web.GetFolder(id);
url = folder.ServerRelativeUrl;
Console.WriteLine(url);
catch (System.IO.FileNotFoundException ex)
Console.WriteLine(ex.Message);
Console.ReadLine();
http://msdn.microsoft.com/en-us/library/office/ms461676(v=office.15).aspx
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/801d1a06-0c9b-429b-a848-dd6e24de8bb9/sharepoint-webservice-to-get-the-guid-of-the-folder?forum=sharepointdevelopmentlegacy
You can also try below:
http://blogs.msdn.com/b/crm/archive/2008/03/28/contextual-sharepoint-document-libraries-and-folders-with-microsoft-dynamics-crm.aspx
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/d2d5d7cf-9bbd-4e0f-a772-ecdce4e6149f/how-to-fetch-document-guid-from-sharepoint-document-library-using-sharepoint-web-service?forum=sharepointdevelopmentlegacy
http://stackoverflow.com/questions/2107716/how-to-get-guid-of-a-subfolder-in-a-document-library-programmatically -
I'd be grateful for any suggestions as to how I can re-open Aperture again. It has been increasingly flaky recently and this isn't the first time it has done a rebuild but is the first time it has failed to start up. Most of my photos are referenced. Many thanks for any help you can give.
Dave-
You can try opening the old (problem) library by launching Aperture into Library First Aid mode and choosing to Repair (first option) or Rebuild the library. Before doing this, make a backup copy of the old library, since both Repair or Rebuild will write changes to the library database.
Repair is the faster and less drastic option, so try that first: After backing up your library, hold down both the Option and Command keys while dragging and dropping the problem library on the Aperture icon. The Photo Library First Aid window appears. Select Repair Database, then click Repair. After some time Aperture should open the library, if possible.
If that fails launch Aperture back into Library First Aid and select Rebuild Database. Depending on the size of your library this operation could take some time, up to several hours for a very large library. When the main window appears you may have some extra Recovered folders/projects. This operation rebuilds the library from scratch and is usually successful at reviving problem libraries. -
Hi,
How to get the root folder name using sharepoint designer WF? i have a document library with root folders and subfolders. so i am trying to get the root specific root folder name attaching with email once user will
upload any files to subfolders within that root folder.
Thanks in advanced!Hi,
According to your description, you might want to get the root folder name in SharePoint Designer Workflow when there is file uploading.
The “Path” field of the current item holds the relative path of a file, as a workaround, you can retrieve the value of the “Path” as string, then split the string
value with a delimiter character of “/” to meet your requirement.
In SharePoint Designer 2010, there is no OOTB action to split the string. You can use the custom workflow actions below to achieve it.
Here is a link about the related actions I use in this scenario:
https://spdwfstringactions.codeplex.com/
Settings of workflow as below:
It works well in my environment:
Best regards
Patrick Liang
TechNet Community Support -
Change Document Library Folder Name from client (JavaScript (JSOM) or Rest)
Hi
According to :
http://social.technet.microsoft.com/Forums/sharepoint/en-US/23441a0d-022a-4d97-8058-b75f32e342d2/rest-api-to-rename-the-folder-move-folder-copy-folder-prog-lang-is-java?forum=sharepointdevelopment
Renaming a folder with Rest is not possible.
and based on:
http://msdn.microsoft.com/en-us/library/office/jj245697(v=office.15).aspx
name property doesn't have any set.
Is it means that renaming a folder is not possible by JSOM or REST?!
RegardsHi,
The following JavaScript Client Object Model code for your reference:
<script type="text/ecmascript">
ExecuteOrDelayUntilScriptLoaded(UpdateListItem, "sp.js");
function UpdateListItem(){
var clientContext;
var oWebsite;
var oList;
clientContext = new SP.ClientContext.get_current();
oWebsite = clientContext.get_web();
oList = oWebsite.get_lists().getByTitle("DocumentLibrary");
oListItem = oList.getItemById(1);
this.oListItem.set_item("FileLeafRef", "Folder Name");
this.oListItem.update();
clientContext.load(this.oListItem);
clientContext.executeQueryAsync(onSuccess, onFailure);
function onSuccess() {
alert('Update succeeded.');
function onFailure(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
</script>
More information:
http://msdn.microsoft.com/en-us/library/office/jj163201(v=office.15).aspx
Thanks,
Dennis Guo
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Dennis Guo
TechNet Community Support -
Help appreciated on this one as I'm OK on my PC but far from a whizz. Done a little investigation and reading of https://discussions.apple.com/thread/5199195?start=0&tstart=0 but I just can't seem to get anywhere and end up with a very underpopulated iTunes.
To set the scene. Been using iTunes for many years and have had several PCs in this time and migrated the library over. Each time I have had a half hearted attempt at organising it all on 1 drive but it has obviously not gone to plan hence my split library and weird file/ folder paths. e.g.
for some reason my recently downloaded apps are stored in C:/users/mark/my music/itunes/mobile applications. I also have numerous itunes library files on this drive
my music is mainly stored on my storage drive B:/itunes music/music/music. On both drives I have mobile applications folders each with many apps in.
I have set my itunes media folder location to B:\iTunes Music\Music so have no idea why all my downloaded apps end up on the C:/, nor have I any idea why they appear in the library seing as the itunes media folder is set to B:/
I hope you can make heads or tails of this as I am even confusing myself as I type!
Help appreciated as every time I try and move stuff around I end up with a very depleted library and have to remember what I moved where to put it back!
MarkSo I right clicked to find the files and relink, and it did not work. The folder name disappeared.
It didn't disappear, it moved (because you told Lightroom to move it). It moved from the incorrect folder location, to the new folder location. Please look in the new folder, in whatever location it is in, not in the old folder and the old location, and you will find the photos. -
Creating a folder for a document library in SharePoint online
Hello I am looking for a good place to get started on creating a folder for a document library using a powershell script. Thanks in advance for any help.
Here is a guide to creating folders and items in a document library for SharePoint Server/Foundation: Creating SharePoint Folders
and Items with PowerShell. You will need to tailor it to your needs as it's a demo for creating 50,000 items.
That's step 1 and contains the bulk of what you would need to do. Here's an example of connecting to a library in SharePoint Online using CSOM: Office
365 - PowerShell Script to Upload Files to a Document Library using CSOM. You won't be uploading files, but the parts where you connect and get a list are what you're interested in.
Now you'll combine bits from both of these scripts:
1. Connect to SPO
2. Get your list (looks like you need to first get the site collection and then the site)
3. Create a folder
I figure it would look something like this (note I haven't tested this at all):
#Specify tenant admin and site URL
$User = "[email protected]"
$SiteURL = "https://tenant.sharepoint.com/sites/site"
$DocLibName = "DocLib"$FolderTitle = "Example Folder"
#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$Password = Read-Host -Prompt "Please enter your password" -AsSecureString
#Bind to site collection
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
$Context.Credentials = $Creds
#Retrieve list
$List = $Context.Web.Lists.GetByTitle($DocLibName)
$folder = $list.AddItem("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder)
$folder["Title"] = $FolderTitle
$folder.Update();
Jason Warren
@jaspnwarren
jasonwarren.ca
habaneroconsulting.com/Insights -
Im using the most recent version of Lightroom 5.3 (updated through CC - even though this has shown up on previous version) on Windows 7 and all the folders in my library are showing up with the directory path in front of my folder names. How can I get rid of this? I do not see any options in preferences to turn this off. I have also turned off preferences in Windows > Folder Options Control Panel "Display full Path in Title bar" option.
I have Lightroom on several computers and have set up preferences the same on each workstation, and this only shows up on one workstation.
Any help would be appreciated.
You can see from the image below how this is showing up.
Thanks
Thanks!Click the little down arrow/+ symbol next the + - in the folders bar.
-
How to keep original Uploaded File Name in SharePoint Document Library?
HI,
I have document library. After Uploaded the file in document library. I want to keep the file name in some other filed.
Why because in future i may change the file name in document library so in order to know the original name of the file.
I want to do without any workflow. Is there any other default column like that?
How could i achieve it?
Thanks & Regards
Poomani SankaranHello,
Here is list of operations for file element, and you can save it in library column:
http://social.technet.microsoft.com/wiki/contents/articles/22156.sharepoint-2010-a-complete-list-of-spfile-operations-using-ecma-script.aspx
http://sprider.org/2011/12/13/sharepoint-ecmascript-to-adddeleteupdateget-list-items/
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
Sharepoint 2010 -Script to get file name from Document Library
Hi
can anybody send be script that works in "SharePoint 2010 management Shell" to get list of file names in document library.
ThankSee my updated answer. The double quotes need to be removed. Also note that you need to use $item.File.Name
and not $item.Name to get the name of the files.
Blog | SharePoint Learnings CodePlex Tools |
Export Version History To Excel |
Autocomplete Lookup Field -
hi friends
i am trying to set peoples or groups field in sharepoint list form with current user login name
here my code
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
<script type="text/javascript">
$(document).ready(function NewItemView () {
var currentUser;
if (SP.ClientContext != null) {
SP.SOD.executeOrDelayUntilScriptLoaded(getCurrentUser, 'SP.js');
else {
SP.SOD.executeFunc('sp.js', null, getCurrentUser);
function getCurrentUser() {
var context = new SP.ClientContext.get_current();
var web = context.get_web();
currentUser = web.get_currentUser();
context.load(currentUser);
context.executeQueryAsync(onSuccessMethod, onRequestFail);
function onSuccessMethod(sender, args) {
var account = currentUser.get_loginName();
var accountEmail = currentUser.get_email();
var currentUserAccount = account.substring(account.indexOf("|") + 1);
SetAndResolvePeoplePicker("requester",account);
// This function runs if the executeQueryAsync call fails.
function onRequestFail(sender, args) {
alert('request failed' + args.get_message() + '\n' + args.get_stackTrace());
function SetAndResolvePeoplePicker(fieldName, userAccountName) {
var controlName = fieldName;
var peoplePickerDiv = $("[id$='ClientPeoplePicker'][title='" + controlName + "']");
var peoplePickerEditor = peoplePickerDiv.find("[title='" + controlName + "']");
var spPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerDiv[0].id];
peoplePickerEditor.val(userAccountName);
spPeoplePicker.AddUnresolvedUserFromEditor(true);
</script>
but it is not working
please help meHi,
According to your post, my understanding is that you wanted to set "peoples or groups" field with current user "login name" in SharePoint list form using JavaScript.
To set "peoples or groups" field with current user "login name”, you can use the below code:
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
<script type="text/javascript">
function SetPickerValue(pickerid, key, dispval) {
var xml = '<Entities Append="False" Error="" Separator=";" MaxHeight="3">';
xml = xml + PreparePickerEntityXml(key, dispval);
xml = xml + '</Entities>';
EntityEditorCallback(xml, pickerid, true);
function PreparePickerEntityXml(key, dispval) {
return '<Entity Key="' + key + '" DisplayText="' + dispval + '" IsResolved="True" Description="' + key + '"><MultipleMatches /></Entity>';
function GetCurrentUserAndInsertIntoUserField() {
var context = new SP.ClientContext.get_current();
var web = context.get_web();
this._currentUser = web.get_currentUser();
context.load(this._currentUser);
context.executeQueryAsync(Function.createDelegate(this, this.onSuccess),
Function.createDelegate(this, this.onFailure));
function onSuccess(sender, args) {
SetPickerValue('ctl00_m_g_99f3303a_dffa_4436_8bfa_3511d9ffddc0_ctl00_ctl05_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_UserField', this._currentUser.get_loginName(),
this._currentUser.get_title());
function onFaiure(sender, args) {
alert(args.get_message() + ' ' + args.get_stackTrace());
ExecuteOrDelayUntilScriptLoaded(GetCurrentUserAndInsertIntoUserField, "sp.js");
</script>
More information:
http://alexeybbb.blogspot.com/2012/10/sharepoint-set-peoplepicker-via-js.html
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Unable to open Sharepoint site with Designer "Folder name is not valid"
Hi all,
I'm using SharePoint 2013 with SharePoint Designer 2013, but currently I'm facing a weird behaviour.
I can open my preproduction SharePoint portal with SharePoint Designer 2013, but when I'm trying to open my production environment, I'm receiving the error "The folder name is not valid". Even it doesn't ask for credentials.
Anyone knows what is happening?There are few other options people used to solve this issue. refer to the following posts if you haven't so far. hope it helps.
http://hightechdave.com/sharepoint-designer-the-folder-name-is-not-valid-error/
http://mesiag.blogspot.com/2011/10/sharepoint-designer-2010-folder-name-is.html
http://community.office365.com/en-us/f/154/t/11825.aspx
Cheers, -
SharePoint Folder names guidelines via CRM
I need some help on this one. We are using CRM 2011 with SharePoint integration based on 3 entities: Account/Opportunity/Quote. We can create the folders in SharePoint by clicking the 'Documents' section on account/opportunity/quote. I was wondering
if someone knows what CRM uses to remove the special characters for an account name/opportunity name/quote name, to create the folder in SharePoint. I want to check for an account folder on SharePoint if it already exists (via the CRM account name),
if it doesn't create it. So I need to find out how folder names are created, so I could compare them. Below I'll show you some examples. I was wondering if there is any documentation/guidelines on this
Example 1: CRM Account name: Company & Sun. Create Folder via 'Documents', SP Folder name: Company - Sun
Example 2: CRM Account name: Company (NY). Create Folder via 'Documents', SP Folder name:
Company (NY)
Example 3: CRM Account name: Compény. Create Folder via 'Documents', SP Folder name:
Compény
Example 4: CRM Account name: CompÅrlö . Create Folder via 'Documents', SP Folder name:
CompArlo
Example 5: CRM Account name: Company N.V. Create Folder via 'Documents', SP Folder name:
Company N-V-
Example 6: CRM Account name: Compäny. Create Folder via 'Documents', SP Folder name:
Compäny.
There are a lot more examples..
You see, there is some logic in this (Not allowed SP characters are, in my opinion, converted to '-'), but what about the alphabetical characters?
Kind RegardsHi,
I do not know the exact replacement logic here, but we have a similar functionality in our DocumentsCorePack and used a different approach.
Because CRM creates a document location record for each SharePoint location you should be able to read in the "SharePoint location" entity if there is an associated record for the account. If this is the case you will get the exact sharepoint link
to this location and know now that you do not need to create it.
Hope I understood your question correctly and my answer helped you.
br,
Christian Ternek, www.mscrm-addons.com
follow us twitter.com/mscrmaddons
Maybe you are looking for
-
[Solved] Running mpd as user mpd with systemd without using mpd.conf
Maybe this is tivial, but I searched about an hour without any results. I want to run mpd as user mpd. I cant use the mpd config file since mpd set the UID and GID explicitely resulting in mpd not having the necessary supplementary groups to access t
-
I need to create .pst ext . file using java,whi will import in ms outlook
{color:#ff0000}*I need to create .PST extension file using java which will be able to import in ms outlook,and that .pst file will contain root folder (like Personal Folders) and inbox,sent mail*{color} give me some hint It is essential task .we have
-
CANT execute query with parameter on user defined tables using query genera
Dear All, I have problem when executing query with parameter on user defined tables using query generator. It seems SBO cannot accept parameter to query user defined tables. I've tried these: SELECT T0.U_Status FROM [@ST_PR_H] T0 WHERE T0.U_Status =
-
Nokia Music (Software) - Can't import files
Hi I'm having trouble importing music with Nokia Music (Version 1.2.20226.01). The files are in a folder on my Windows desktop, but for some reason when I try to import them into Nokia Music, it doesn't see them. Even stranger is the fact that the fi
-
£120 data charges on o2 whilst in mexico data roaming turned off, advisor says its a characteristic of i phone 6 , when it cant get wifi it can sometimes switch back to mobile data ??? i don't think so but happy to stand corrected