0

I am using Sharepoint 2013. I am trying to retrieve a sharepoint list that contains list of all products from the server as an anonymous user using ECMA script/ JavaScript. I understand that it can be done using admin privileges and elevated rights. However, I want the user to be anonymous.

Can anyone give some suggestion how it can be done ??

edit 1: I am trying to achieve this feat purely using scripting code(ECMA/ JS). Is their possibly any way to do it ?

  • Please find an answer & let me know if it won't work....sharepoint.stackexchange.com/questions/87534/… – Hardik Dec 26 '18 at 12:54
  • Actually, I am trying to avoid this method i.e. via site setting, as per the requirement, I am trying to do it through ECMA code. I am trying to access the list purely through code( ECMA / JS ). – P.Prasad Dec 26 '18 at 14:18
0

Try to set list AnonymousPermMask using PowerShell below, then use JSOM to get list items.

add-pssnapin microsoft.sharepoint.powershell
$siteurl = "[your site URL]"
$listname = "[your list name]"
$a = (get-spweb $siteurl).lists | where title -eq $listname
$a.AnonymousPermMask​64 = "ViewListItems, UseClientIntegration, UseRemoteAPIs"

As a workaround, we can create a custom web service to get list items from list that allows for anonymous access.

We can also create SharePoint Add-ins that can be used by anonymous users.

Refer to: Create SharePoint Add-ins that can be used by anonymous users

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.