Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Hey am trying to rename a folder inside a Document library, right now i get my item and everything is good but when i try to rename it using set_item('title', 'NewFolderName') it crashes and unwinds the stack.

Is there some kind of documentation that would help us with that ? Should i be doing this on the backend instead of the frontend ?

Working

context = SP.ClientContext.get_current(); 
var iter = folderList.getEnumerator();
iter.moveNext();

var folder = iter.get_current();

 folder.set_item('Title', 'TestTitleRename');
 folder.set_item('FileLeafRef', 'TestTitleRename');
 folder.update();
 context.executeQueryAsync(Success,Failure);

Thanks

share|improve this question
1  
Have you not only set the "Title" but also the "FileLeafRef" (to the same value as the Title)? –  marco Apr 13 '12 at 19:41
    
Yes i was missing FileLeafRef, post as answer and ill mark yours. Thanks :D –  Dr.Denis McCracleJizz Apr 13 '12 at 20:23

2 Answers 2

up vote 5 down vote accepted

As I commented already: ;-)

You have to set not only the "Title" but also the "FileLeafRef".

share|improve this answer

What exactly is the error you are getting? Can you post your code here?

See the following link on updating a listitem. (The folder is also a list item ultimately)

http://msdn.microsoft.com/en-us/library/hh185011.aspx

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.