English 中文(简体)
Sharepoint: difference between Title, Name and DisplayName for library folders
原标题:

Sorry if this has been asked elsewhere. I have looked but can t find any definitive answers.

I m writing an app for SharePoint 2010 that needs to create folders in a document library; one for each "job" that the app processes, as a place to put the job output. But, I m having problems with folder name collisions. Each "job" is encoded as an xml file in another SharePoint list. For example, it might contain an xml file called "from docx to pdf.xml". So far I have the app creating subfolders in the output list using the job files name minus the extension. So, a folder called "from docx to pdf" in this case. But, some time later, the app might have to re-process the exact same job. I want to be able to have another subfolder in the same list as the first, with the exact same name visible to the user in a browser...

Can you do this in SharePoint lists? It seems ordinary SPListItems have Name, DisplayName and Title properties. Obviously, one of these must be unique, so that SharePoint can uniquely identify that item. But which is it? And does the same apply to SPFolder items in a list? I guess here I want to have something like duplicated folder display names, but unique internal names. Do you have any ideas on how to do this? So far, my crappy method goes something like this:

 private SPFolder CreateSubFolder(SPList list, string visibleFolderName)
    {           
        // create a new folder under the root folder
        SPListItem newFolder = list.AddItem("", SPFileSystemObjectType.Folder, visibleFolderName);            
        newFolder.Update();               
        return newFolder.Folder;
    }

This obviously doesn t work. Any ideas on how to alter to have the same visible name, but diff internal names (perhaps using Guids...)?:D Thanks in advance.

最佳回答

Like in ordinary file systems, folders under the same sub folder must be unique. Thus, the last parameter of the Add() method should be unique, because it indicates the folder name.

You can safely asssign a duplicate title after creating the folder, using this piece of code:

SPListItem newFolder = list.Items.Add("", SPFileSystemObjectType.Folder, uniqueFolderName);
newFolder["Title"] = "New Folder"; // Can be duplicated
newFolder.Update();

Now you will have folders with same titles but different names. Still, when you try to browse these folders from Windows Explorer or SharePoint default list view, it will show you the folder name (which is unique), not the titles (which you want). So you need to create a custom view and display the title field instead of the folder name.

问题回答

暂无回答




相关问题
SharePoint - Approaching Website Storage Limit Email

How can i go about changing the distribution list as well as the email text for the email that goes out to site collection admin when a site collection approaches it s size limit? Thanks for your ...

UI automated testing within SharePoint

I m looking for automated Functional Testing tools that can manipulate SharePoint sites, libraries, and documents thought the web interface. It needs to be extensible enough to handle any custom ...

Enable authorization on sitemap provider

I want to enable Authorization on the Site map provider. We have enabled anonymous access to the site and we want the Site map provider to be visible only to authorized users. I tried ...

SharePoint : web service permission error

I have a sharepoint site, and I am calling a standard sharepoint web service. I create the web service request like this : wsDws.Url = this.SiteAddress + @"/_vti_bin/Dws.asmx"; When I use ...

Sharepoint 2007 Data view Webpart custom parameters

I m sort of new to the custom parameters that can be setup on a DataView Webpart. There are 6 options: - None - Control - Cookie - Form - QueryString - Server Variable I think that None, Cookie and ...

热门标签