3

I'm developing a SP2013 office 365 app using the Sharepoint hosted option so working with JS.

I'm allowing users to create new records in a list and also displaying that list of records that are created.

I need only records created by that user to be displayed to them...currently everyone see's every record. I know how to filter on the list programmatically but not sure how to do it using the user credentials...

MORE INFO

Ok managed to move things on and I'm now pretty close the solution...

When you read the list in you use the CamlQuery option as follows.

var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='Author' /><Value   Type='Text'>" + fullUserName + "</Value></Eq></Where></Query></View>");

Points to note is the Created By is actually Author!

What I'm now unsure of is what is stored in the created by? Is it just the users name or name and ID? Can't get the query to work when using the name..anyone know?

3 Answers 3

4

At the list view is possible.

Edit the list view (click in modify this exhibition), it will have the filters below, place "created by" equals "[Me]". SharePoint puts own how-to tips.

check this articles:

Example 1

Example 2

1
  • Thanks for the feed back Diego...managed to move things on a little..
    – Stephen
    Commented Jan 7, 2014 at 16:25
0

The following code worked for me...

var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='Author' LookupId='TRUE' /><Value Type='Integer'><UserID /></Value></Eq></Where></Query></View>");

Thanks for the input.

0

Enable Item-Level security as shown in the picture. SharePoint 2013 List Item level permissions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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