3

so I know in the view editor one can add the option of filtering by [me]. My question, is is there any way to do this in the URL and not the view?

I would like to keep the standard allitems.aspx, but add a filter like such:
?&FilterField1=Editor&FilterValue1=[Me]

Now, I tested this and it doesn't work, it filters by the literal value of "[me]", which we have no users with that name (obviously).

  • I think no. Why are you trying to do that? Perhaps there is another approach – Juan Pablo Pussacq Laborde Jul 20 '16 at 16:25
  • I am trying to work on parameter based pages where we load in different document libraries, each with the same filter, based on the URL parameters – Sabien Ambrose Jul 20 '16 at 18:09
3

Using JSOM you can find the current user login and create the View URL dynamically.

var clientContext = new SP.ClientContext.get_current();
var oWeb = clientContext.get_web();
var currentUser = oWeb.get_currentUser();
clientContext.load(currentUser);
clientContext.executeQueryAsync(function() {
    //currentUser.get_loginName();
    //currentUser.get_id();
}, function(sender, args) {
    alert('Request failed. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());
});
  • is the .get_loginName() function what returns the name i should filter by? – Sabien Ambrose Jul 20 '16 at 17:03

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.