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?!
Regards

Hi,
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

Similar Messages

  • How to get the Current Document Library View Name from Code - C#

    Hi,
    I have a requirement where i have a doc lib - doclib and two view view1 and view2.The columns vary for the two views.
    Now a user can select and of the two views and do a particular operation.
    I need to programatically find out which view the user is currently at.Now i know that just by picking the URL i can understand if its doclib/view1.aspx or doclib/view2.aspx. But this is not possible as my scenario
    because of an architecture limitation of my project.
    Is there any way to find out the view like libraray.currentview or using spview.
    I need to make so column updates based on the view selected. 
    Please help.

    Try below code as you in the SharePoint context.
    Guid siteId = SPContext.Current.Site.ID;
    Guid webId = SPContext.Current.Web.ID;
    SPSecurity.RunWithElevatedPrivileges(delegate()
        using (SPSite site = new SPSite(siteId))
            using (SPWeb web = site.OpenWeb(webId))
                // Your code here
    Hope this will helps you
    Senthilrajan Kaliyaperumal

  • Event Receiver to get folder Names from List View Web Part

    Hi,
    We have a requirement i.e.
    On one of the page,there are some folders on the list view web part.
    Now through event receiver i should pick the folder names from list view web part and
    update the same in the list.
    If that names already exists in the list then we should leave without updating,if not we have to add folder name in the list.
    Please share your ideas regarding the same.
    Regards,
    Naga Sudheer M
    Thanks & Regards, Sudheer

    Hello,
    LVWP is just for displaying content of site so you need to associate your event receiver with actual list/library. You can create ItemAdded event receiver to check existing folder and create new if not existing. "sk2014" links are good to start.
    http://sharepoint.stackexchange.com/questions/59788/change-name-in-itemadding-event-receiver-or-create-a-new-item
    Let us know in case any doubt
    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

  • Connecting a SharePoint 2013 Document Library to Outlook 2010 client

    Good Day,
    Can someone please confirm if you can connect a SharePoint 2013 Document Library to Outlook 2010 client?
    I have seen articles, like the one shown below for Outlook 2013 to SharePoint 2013;
    http://www.sharepointgeoff.com/how-to-connect-a-sharepoint-2013-document-library-to-outlook-2013/
    Please provide a link to documentation to validate what Outlook Office versions will support viewing Document Library from Outlook client from a SharePoint 2013 Document Library.
    Thanks in advance for taking the time to review my request.
    Regards,
    Mark

    Hi Mark,
    Per my understanding, you might want to connect SharePoint 2013 Document Library to Outlook 2010 client application.
    Yes, SharePoint 2013 Document Library can connect to Outlook 2010 client application, the connecting process is similar as what SharePoint 2013 connect to Outlook
    2013 client application does.
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Set Folder Name From File Name Inclosed.

    Hello scripters,
    There has been quite a few topics about setting file names from parent folders. I believe it's possible but not sure how to reverse this process. That is to say set the folder name from a file in the folder. This is what I'm imagining.
    I've got a folder. In the folder are 100 folders with the names "untitled folder xxx" In side I've got files that are all named and numbered.
    For example,
    untitled folder/B-day 001~050.jpg
    untitled folder 50/At The Park 001~020.jpg
    I would like a script to change the name of the parent folder of the files that it houses.
    So untitled folder becomes
    B-Day
    untitled folder 50 becomes
    At The Park
    etc…
    I think getting the name of the first file (minus the index number) would be easiest.
    Any help or futher questions are greatly appreciated.
    Maximilian

    Working backwards...
    Assuming all the files have the same name structure (e.g. end in the format "xxx~xxx.jpg" you can get the base name using:
    <pre class=command>set baseName to characters 1 through -13 of filename as text</pre>
    This cuts off the last 12 characters of the file name.
    Once you have a folder, you can get the names of files in the folder via the Finder. for sanity's sake I'd ask the Finder for the first item, just in case there's more than one file:
    <pre class=command>set filname to name of first item of (files of folder theFolder)</pre>
    And if all the folders are in one top folder, you can iterate through them like:
    <pre class=command>repeat with eachFolder in (every folder of folder topFolder)</pre>
    So now, string it all together:
    <pre class=command>tell application "Finder" -- we'll use the Finder to do the legwork
    set topFolder to (choose folder with prompt "Choose the top level folder" ) -- get the top folder
    repeat with eachFolder in (every folder of folder topFolder)
    set fileName to name of first file of (files of folder topFolder)
    set baseName to characters 1 through -13 of fileName as text
    set name of folder eachFolder to baseName
    end repeat
    end tell</pre>
    Note there's no error checking - the script will fail if there are no files in any particular folder, but it should get you going.

  • How do I change the 'tempuser' folder name?

    Trying to set up an old (2006) Macbook for my daughter to replace her (even older) old one. I have an account with her name, but the documents and photos are stoored under a folder called "tempuser" which I think might confuse her. Can I rename that folder to 'Amina' or 'Mom' or 'Mine' or something? How? It won't allow a straight renaming of the folder.

    I'm not sure how those steps worked for you.  Perhaps those used MacBooks had older operating systems.  The current 10.7+ will not allow you to change the Home Folder name.  You can move the contents of the old folder to a new folder using Terminal.  However, doing this will cause you to lose every personal setting, email accounts, browser history and on and on.  In fact, when booting up into the old username you are presented with all of the welcome stuff you get when you do a fresh install.  All of the files and applications and preferences are still on your disk, they are just no longer associated with your user.

  • Sharepoint document library file name column in content database?

    Hi,
    How to get a sharepoint document library file name column in content database?
    Thanks
    Poomani Sankaran

    You're not supposed to develop any solutions accessing the content database directly. It's not supported. Document Library Filename is stored in LeafName column, table: AllDocs.
    2.2.6.1 AllDocs Table
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • HT2470 I need to change the home folder name. I just bought this mac today and my cousin put his name in because he had to back up his phone while we were still at the store so he could get a new phone and now my brand new imac says his name in the home f

    I need to change the home folder name. I just bought this mac today and my cousin put his name in because he had to back up his phone while we were still at the store so he could get a new phone and now my brand new imac says his name in the home folder. This is very frustrating. I would not have let him put his name in there if I didn't think you could change it. Someone please help!

    Delete his user account and create your own, using your name.

  • I traded for a mac; how can I change the home folder name?

         Well I traded a PC for my first iMac and well...... I love it.
    1.  I'm running into a little problem though; I can't seem to change the home folder name to my name.  Although I know it doesn't affect any of the operation of the system or my settings, it psychologically upsets me. 
    2.  Also, is there a way to assign my Apple ID to the computer or does that not matter either? 
    3.  I also see a little lag when trying to connect to the web, but once I do get on it seems pretty beefy, any suggestable reasons? 
    4.  And the final question, did I make the right decision? I traded a Sony Vaio S series tablet (laptop/PC) with an Intel core i5 @ 2.30ghz for an iMac with an Intel Duo Core processor @ 3.06ghz. I've heard the numbers don't really matter but some clarification would help.

    Trying to address some of your questions:
    You state you are running Mountain Lion? Was that the original OS on the Mac? That is very important because:
    a) if it was, the seller/trader needed to transfer the Mountain Lion license to you or it will stay with his Apple ID;
    b) if he purchased ML, he is required to uninstall it before selling the machine because the license is not transferable, which means - again - that it is tied to his Apple ID (along with the machine ID).
    Both/either can present some problems for you since ML is now tied to someone else's Apple ID. If you manage to "introduce" your Apple ID, it will no longer match the records MAS (Mac App Store) has, so updates or other purchases may present problems.
    I would suggest that you either call Apple or book an appointment at the nearest Genius Bar and ask them how to proceed - that way you may be able to set up your own Apple ID on the machine as well as get ML registered as yours (although, as explained above, they may require you to purchase it for yourself).
    Whether or not you made the right decision - well, I've never owned a Windows machine, so I can't answer your question since I have nothing to compare it with. Obviously, I use Macs...... you should be able to run your own test: just do what you normally do and see if it appears to take about the same time, is faster, or is slower.

  • 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

  • Create folder in Document Library using Sharepoint 2010 Client Object Model

    I would like to check for the existence of a folder in s Sharepoint 2010 Document Library and if the folder is not found, create it. (I would then subsequently programmatically upload documents to that folder -- which I have figured out). Can someone
    please help me figure out how to check for the extistence of and then create a folder using the Sharepoint 2010 Client Object Model?

    You can use this:
    public static void CreateFolder_ClientOM(string listName, string folderName)
    ClientContext clientContext = new ClientContext("http://basesmc2008");
    Web web = clientContext.Web;
    List list = clientContext.Web.Lists.GetByTitle(listName);
    clientContext.Load(clientContext.Site);
    string targetFolderUrl = listName + "/" + folderName;
    Folder folder = web.GetFolderByServerRelativeUrl(targetFolderUrl);
    clientContext.Load(folder);
    bool exists = false;
    try
    clientContext.ExecuteQuery();
    exists = true;
    catch (Exception ex)
    if (!exists)
    ContentTypeCollection listContentTypes = list.ContentTypes;
    clientContext.Load(listContentTypes, types => types.Include
    (type => type.Id, type => type.Name,
    type => type.Parent));
    var result = clientContext.LoadQuery(listContentTypes.Where
    (c => c.Name == "Folder"));
    clientContext.ExecuteQuery();
    ContentType folderContentType = result.FirstOrDefault();
    ListItemCreationInformation newItemInfo = new ListItemCreationInformation();
    newItemInfo.UnderlyingObjectType = FileSystemObjectType.Folder;
    newItemInfo.LeafName = folderName;
    ListItem newListItem = list.AddItem(newItemInfo);
    newListItem["ContentTypeId"] = folderContentType.Id.ToString();
    newListItem["Title"] = folderName;
    newListItem.Update();
    clientContext.Load(list);
    clientContext.ExecuteQuery();
    Blog | SharePoint Field Notes Dev Tool |
    ClassMaster

  • Download files from document library in zip file using javascript

    Hi,
    I am developing SharePoint Hosted App which needs to download all the files in the document libraries of SharePoint site in a zip folder where in that zip file each document library should be a folder, in that folder the files of that document library will
    be shown. Currently I am display all the document library in a table with check boxes as shown in the below figure. Now when user selects the check boxes and click on download button, the selected document libraries along with the files should be downloaded
    in a zip folder. This should be achieved through javascript. Can anyone share me the code to solve this problem.
    Thanks & Regards,
    Kishore
    Kishore

    You can use
    zip.js, but the best way - implement your solution on the server-side.
    [custom.development]

  • Did you change your home folder name and now your computer is all wierd?

    Hello. I did the same thing and I called apple help and they just couldn't help me on this subject. I was messing around with the computer and I found a proper solution where you don't have to re-install the software. Here are the steps:
    Step one: login (if your not already logged in) into the account. It should still be there as the original name.
    Step two: Open your Finder or HD and select the Users folder.
    Step three: You should see your original account name as well as any one else's account name if you have other people sharing the computer. In addition to this you will also see the name you attempted to use as a replacement for your old Home Folder name, note that this is a new unexpected user.
    Have it in column mode for the easiest experience.
    In the new folder you created (this is the user on the list that you named your original folder) You will find all your old settings. Don't do anything yet! take and highlight all of the content in that folder by holding shift and clicking or your preferred way. Drag ALL the content to your original home folder, which should only have library and Documents. (if it has more than it's okay) it will tell you that there are already folders with that name and will ask permission to replace them. Say yes.
    Step four: log out or restart your computer.
    Step five: log in, and or wait till it's restarted Your desktop and dock should be restored to the way you originally had it. Don't change the name on it again. if you want to change the name, you'll need to create a new user.
    Step six: Thank me and leave me complements or questions.

    I think it is rather surprising that the Mac OS allows you to change the name of the home folder and doesn't seem to put up a warning or anything.
    I did change the short name used on my home folder about three weeks ago. I used ChangeShortName Utility v1.2 which I got from here:
    http://www.macosxpowertools.com
    All indications are that using this utility has been 100% successful.
    I did create a new temporary account with administration privileges and I ran the utility from that account. This meant I wasn't changing the short name on the account I was actually using.
    It is very important to read the "read me" with ChangeShortName so that you are 100% sure of what you are doing when you use it.
    Also, of course, back up first

  • Split library, folder names and paths are in a mess. Need to get library all in one place on my storage drive and off my OS drive. In a fix!

    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!
    Mark

    So 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.

  • How to get sharepoint document library metadata details from sql?

    I am creating a windows form application , in which user selects document library and after clicking on button I am creating an excel file which displays all document name with its metadata information.
    The select query which I am querying to SQL Server is:
    DECLARE @listId AS UNIQUEIDENTIFIER = 'c8508816-a7fb-43f1-82d1-62d79cbaf8e6';
    DECLARE @fileNameFilter AS VARCHAR (250) = NULL;
    DECLARE @dirFilter AS VARCHAR (250) = NULL;
    SELECT DISTINCT
    d.Id AS 'FileId',
    d.WebId AS 'WebId',
    d.SiteId AS 'SiteId',
    d.DirName AS 'DirName',
    d.LeafName AS 'FileName',
    ISNULL(d.Size,0) AS 'Size',
    d.UIVersion AS 'UIVersion',
    ISNULL(d.InternalVersion,0) AS 'InternalVersion',
    ISNULL(d.ETagVersion,0) AS 'ETagVersion',
    d.Type as 'Type',
    aud.tp_Created AS 'Created',
    ui.tp_Login AS 'CreatedBy'
    FROM AllDocs AS d
    INNER JOIN
    AllUserData AS aud
    ON d.Id = aud.tp_DocId
    INNER JOIN
    UserInfo AS ui
    ON aud.tp_Author = ui.tp_ID
    WHERE d.ListId = @listId
    AND (@fileNameFilter IS NULL
    OR d.LeafName LIKE '%' + @fileNameFilter + '%')
    AND (@dirFilter IS NULL
    OR d.DirName LIKE '%' + @dirFilter + '%');
    By using this query I am able to get the file name, its directory name, version but I want to fetch all data like custom fields with this query. I don't know which table to query for custom fields and content type fields.
    Please help.

    Hello,
    MS never suggest to query content database directly. If you do this then you are on risk and can face performance issue.
    if you really wants to get document name and it's metadata then use lists.asmx in windows application. This is standard way to get data from site.
    http://msdn.microsoft.com/en-us/library/dd490727%28v=office.12%29.aspx
    Hope it could help
    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

Maybe you are looking for