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

i am currently running some code on a sharepoint front end and am getting this error

"Microsoft.SharePoint.SPException"
"Cannot complete this action.\n\nPlease try again."

So i looked into this and it seems its because i dont have the right permissions on the list. But when i check the permissions i have Full control.

What am trying to achieve is actually simple, get a list of documents inside a specific folder in a Document library.

I dunno have any permissions on the Document library but i have full control on some folders inside that Document library.

Here is the code am using.

function RenommerDossier(Foldername) {


    var myQueryString = "<View><Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + Foldername + "</Value></Eq></Where><OrderBy><FieldRef Name='Title' /></OrderBy></Query>";
    var MyUsername = 'Steve'
    myDocLibrary = GetListByname("Documents des juges");//my custom function, works good

    var context = new SP.ClientContext.get_current();
    var query = new SP.CamlQuery();

    query.set_viewXml(myQueryString);
    var stringFullFolderUrl = 'MyDocumentLibrary/' + MyUsername + '/' + Foldername;
    query.set_folderServerRelativeUrl(stringFullFolderUrl);



    myFolders = myDocLibrary.getItems(query);

    context.load(myFolders);

    context.executeQueryAsync(
        Function.createDelegate(this, this.OnLoadBibliothequeDossierSuccess),
        Function.createDelegate(this, this.OnFailedLoadDossier)
     );
}

If anyone could help i would be glad, thank you ;)

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Just for starters, while reading your code, I just noticed that your caml query does not have a closing </View> tag.

it should be like this:

var myQueryString = "<View><Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + Foldername + "</Value></Eq></Where><OrderBy><FieldRef Name='Title' /></OrderBy></Query></View>";

See if it works out. Also, it would be great if you could post the code for GetListByName() function.

share|improve this answer
    
was just that ! thanks alot ;) –  Dr.Denis McCracleJizz Apr 13 '12 at 17:57
add comment

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.