1

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 ;)

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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